Public Class frmBankAccount Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox Friend WithEvents radDeposit As System.Windows.Forms.RadioButton Friend WithEvents radWithdraw As System.Windows.Forms.RadioButton Friend WithEvents txtAmount As System.Windows.Forms.TextBox Friend WithEvents lblAmount As System.Windows.Forms.Label Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents lblBalance As System.Windows.Forms.Label Friend WithEvents btnClear As System.Windows.Forms.Button Friend WithEvents MenuStrip1 As System.Windows.Forms.MenuStrip Friend WithEvents FileToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ClearFormToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ExitToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents btnTransaction As System.Windows.Forms.Button Private Sub InitializeComponent() Me.GroupBox1 = New System.Windows.Forms.GroupBox Me.radDeposit = New System.Windows.Forms.RadioButton Me.radWithdraw = New System.Windows.Forms.RadioButton Me.txtAmount = New System.Windows.Forms.TextBox Me.lblAmount = New System.Windows.Forms.Label Me.Label1 = New System.Windows.Forms.Label Me.lblBalance = New System.Windows.Forms.Label Me.btnTransaction = New System.Windows.Forms.Button Me.btnClear = New System.Windows.Forms.Button Me.MenuStrip1 = New System.Windows.Forms.MenuStrip Me.FileToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem Me.ClearFormToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem Me.ExitToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem Me.GroupBox1.SuspendLayout() Me.MenuStrip1.SuspendLayout() Me.SuspendLayout() ' 'GroupBox1 ' Me.GroupBox1.Controls.Add(Me.radDeposit) Me.GroupBox1.Controls.Add(Me.radWithdraw) Me.GroupBox1.Location = New System.Drawing.Point(272, 24) Me.GroupBox1.Name = "GroupBox1" Me.GroupBox1.Size = New System.Drawing.Size(128, 104) Me.GroupBox1.TabIndex = 0 Me.GroupBox1.TabStop = False Me.GroupBox1.Text = "Transaction" ' 'radDeposit ' Me.radDeposit.Location = New System.Drawing.Point(16, 24) Me.radDeposit.Name = "radDeposit" Me.radDeposit.Size = New System.Drawing.Size(104, 24) Me.radDeposit.TabIndex = 0 Me.radDeposit.Text = "Deposit" ' 'radWithdraw ' Me.radWithdraw.Location = New System.Drawing.Point(16, 64) Me.radWithdraw.Name = "radWithdraw" Me.radWithdraw.Size = New System.Drawing.Size(104, 24) Me.radWithdraw.TabIndex = 0 Me.radWithdraw.Text = "Withdrawal" ' 'txtAmount ' Me.txtAmount.Location = New System.Drawing.Point(128, 32) Me.txtAmount.Name = "txtAmount" Me.txtAmount.Size = New System.Drawing.Size(112, 20) Me.txtAmount.TabIndex = 1 ' 'lblAmount ' Me.lblAmount.Location = New System.Drawing.Point(32, 35) Me.lblAmount.Name = "lblAmount" Me.lblAmount.Size = New System.Drawing.Size(80, 16) Me.lblAmount.TabIndex = 2 Me.lblAmount.Text = "Enter Amount:" ' 'Label1 ' Me.Label1.Location = New System.Drawing.Point(24, 104) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(96, 16) Me.Label1.TabIndex = 2 Me.Label1.Text = "Current Balance" ' 'lblBalance ' Me.lblBalance.BackColor = System.Drawing.Color.Transparent Me.lblBalance.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D Me.lblBalance.ForeColor = System.Drawing.Color.Black Me.lblBalance.Location = New System.Drawing.Point(128, 104) Me.lblBalance.Name = "lblBalance" Me.lblBalance.Size = New System.Drawing.Size(112, 16) Me.lblBalance.TabIndex = 3 ' 'btnTransaction ' Me.btnTransaction.Location = New System.Drawing.Point(72, 64) Me.btnTransaction.Name = "btnTransaction" Me.btnTransaction.Size = New System.Drawing.Size(120, 24) Me.btnTransaction.TabIndex = 4 Me.btnTransaction.Text = "&Perform Transaction" ' 'btnClear ' Me.btnClear.Location = New System.Drawing.Point(179, 134) Me.btnClear.Name = "btnClear" Me.btnClear.Size = New System.Drawing.Size(75, 23) Me.btnClear.TabIndex = 5 Me.btnClear.Text = "&Clear" Me.btnClear.UseVisualStyleBackColor = True ' 'MenuStrip1 ' Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.FileToolStripMenuItem}) Me.MenuStrip1.Location = New System.Drawing.Point(0, 0) Me.MenuStrip1.Name = "MenuStrip1" Me.MenuStrip1.Size = New System.Drawing.Size(432, 24) Me.MenuStrip1.TabIndex = 6 Me.MenuStrip1.Text = "MenuStrip1" ' 'FileToolStripMenuItem ' Me.FileToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ClearFormToolStripMenuItem, Me.ExitToolStripMenuItem}) Me.FileToolStripMenuItem.Name = "FileToolStripMenuItem" Me.FileToolStripMenuItem.Size = New System.Drawing.Size(35, 20) Me.FileToolStripMenuItem.Text = "&File" ' 'ClearFormToolStripMenuItem ' Me.ClearFormToolStripMenuItem.Name = "ClearFormToolStripMenuItem" Me.ClearFormToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.ClearFormToolStripMenuItem.Text = "&Clear Form" ' 'ExitToolStripMenuItem ' Me.ExitToolStripMenuItem.Name = "ExitToolStripMenuItem" Me.ExitToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.ExitToolStripMenuItem.Text = "E&xit" ' 'frmBankAccount ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.BackColor = System.Drawing.SystemColors.Control Me.ClientSize = New System.Drawing.Size(432, 182) Me.Controls.Add(Me.btnClear) Me.Controls.Add(Me.btnTransaction) Me.Controls.Add(Me.lblBalance) Me.Controls.Add(Me.lblAmount) Me.Controls.Add(Me.txtAmount) Me.Controls.Add(Me.GroupBox1) Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.MenuStrip1) Me.MainMenuStrip = Me.MenuStrip1 Me.Name = "frmBankAccount" Me.Text = "Bank Account" Me.GroupBox1.ResumeLayout(False) Me.MenuStrip1.ResumeLayout(False) Me.MenuStrip1.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() End Sub #End Region Dim mdecBalance As Decimal Private Sub btnTransaction_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTransaction.Click Dim decAmount As Decimal = CDec(txtAmount.Text) If radDeposit.Checked Then Deposit(decAmount) ElseIf radWithdraw.Checked Then Withdraw(decAmount) End If lblBalance.Text = FormatCurrency(mdecBalance) End Sub Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click ClearForm() End Sub Private Sub ClearFormToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearFormToolStripMenuItem.Click ClearForm() End Sub Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click Me.Close() End Sub Private Sub Deposit(ByVal decAmount As Decimal) mdecBalance += decAmount End Sub Private Sub Withdraw(ByVal decAmount As Decimal) mdecBalance -= decAmount End Sub Private Sub ClearForm() txtAmount.Clear() lblBalance.Text = "" mdecBalance = 0D End Sub End Class