I have a banking program, which displays (in text boxes) a current balance, withdrawal, deposit, and final balance. There's also four command buttons: calculate, new, clear, and exit. When I hit the new command button, I'm supposed to able to calculate the number of withdrawals and number of deposits that have occurred and display them in separate text boces. I can't seem to figure this out, but here's what I've tried before.
cmdNew is the command box captioned "New" that should tally the deposits and withdrawals made so far.
txtDeposit is the text box that allows the user to enter the amount of money that they would like to deposit.
txtWithdraw is the text box that allows the user to enter the amount of money that they would like to withdraw
txtDepositCount is the text box that displays the number of times a user has made a deposit
txtWithdrawalCount is the text box that displays the number of times a user had made a withdrawal
I'm not getting error messages necessarily, but the program just doesn't work. I either end up with both the txtWithdrawalCount.Text and txtDepositCount.Text being 1 and not changing after another transaction is made, or nothing happening at all, or causing an infinite loop.
Private Sub cmdNew_Click() Dim Deposit as Integer Deposit = Val(txtDepositCount.Text) Deposit = 0 Do If txtDeposit.Text = Blank Then Deposit = Deposit Else Count = Count + 1 End If Loop Dim Withdrawal as Integer Withdrawal = Val(txtWithdrawalCount.Text Withdrawal = 0 Do If txtWithdrawal.Text = Blank Then Withdrawal = Withdrawal Else Withdrawal = Withdrawal + 1 End If Loop End Sub
Thanks in advance for the help!
Oops sorry! Line 11 should have said the following instead.
[Deposit = Deposit + 1]
This post has been edited by modi123_1: 24 April 2013 - 12:13 PM
Reason for edit:: fixed botched code tag