|
The other Change Calculator post should be deleted, this new post was made to reflect my progress and to prevent any confusion.
Here is the original problem: A form will accept two types of input then perform a calcuation. The two inputs are,
1- How much money a customer owes me 2. How much money the customer paid/tendered
The program must then calculate the change that is due, but it must be displayed in 5 fields..
example -
$5.50 due, customer pays $10 Program must show -
Dollars owed - 4 Quarters owed - 2 Dimes owed - 0 Nickeles owed - 0 Pennies owed - 0
Of course, the input amounts will vary and the program needs to be able to calculate various inputs.
I coded my calculation button with the code below. However, the calculation process does not seem to make it past the first "Case" statement. The "mydollars" value seems to only hold and display the number one and it appears the calculation process just stops, because no other fields display any information. And most notably, the "mydollars" field doesn't go any higher than 1.
Maybe one of you guru's can tell me what i did wrong here:
'Begin change calculation While changedue2 > 0 Select Case changedue2 'Dollar calculation Case Is >= 1 myDollars = +1 changedue2 = -1 'Displays variable values on form DollarField.Text = myDollars 'Quarters Case Is >= 0.25 myQuarters = +1 changedue2 = -0.25 QuarterField.Text = myQuarters 'Dimes Case Is >= 0.1 myDimes = +1 changedue2 = -0.1 DimeField.Text = myDimes 'Nickels Case Is >= 0.05 myNickles = +1 changedue2 = -0.05 NickelField.Text = myNickles 'Pennies Case Is >= 0.01 myPennies = +1 changedue2 = -0.01 PennyField.Text = myPennies
'Error Handler Case Else MessageBox.Show("Something went wrong") End Select End While
|