| | |
The "Change Solution" Help Needed
![]() |
•
•
Join Date: Oct 2007
Posts: 89
Reputation:
Solved Threads: 0
hello all,
been working on this assignment with the VB 2005 book for about a week now and i don't really understand where to go next. it's under lesson C exercise 3 where i have to calculate the amount of change and how many dollars, then quarters (dimes, nicks, pennies) that i have to give the customer.
i know that i need some type of if then statement but i'm not sure where to go with it and my program now is just locking up my PC. Help please.
oh and when you show me. tell me why i do it this way because it will really help me understand more.
thanx guys/gals
been working on this assignment with the VB 2005 book for about a week now and i don't really understand where to go next. it's under lesson C exercise 3 where i have to calculate the amount of change and how many dollars, then quarters (dimes, nicks, pennies) that i have to give the customer.
i know that i need some type of if then statement but i'm not sure where to go with it and my program now is just locking up my PC. Help please.
oh and when you show me. tell me why i do it this way because it will really help me understand more.
thanx guys/gals
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Public Class MainForm Dim TotalChange As Double Private Sub xButtonExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xButtonExit.Click Me.Close() End Sub Private Sub xButtonClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xButtonClear.Click 'clear all fields and focus back to amount owed Me.xAmountOwedText.Text = String.Empty Me.xAmountPaidText.Text = String.Empty Me.xDollarsCalc.Text = String.Empty Me.xQuartCalc.Text = String.Empty Me.xDimeCalc.Text = String.Empty Me.xNickCalc.Text = String.Empty Me.xPennyCalc.Text = String.Empty Me.xAmountOwedText.Focus() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xCalculateButton.Click Dim Dolla As Integer Dim Quart As Integer 'calculate the total change and assign to the correct text boxes TotalChange = Val(Me.xAmountPaidText.Text) - Val(Me.xAmountOwedText.Text) Integer.TryParse(Me.xDollarsCalc.Text, Dolla) If Dolla >= 1 Then Dolla = Dolla / 1 End If Integer.TryParse(Me.xQuartCalc.Text, Quart) If TotalChange > 0.25 Then Quart = Me.xDollarsCalc.Text / 0.25 End If 'display message, tax and name Me.xMessageLabel.Text = "The change owed to the customer is " & Format(TotalChange, "currency") End Sub End Class
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: excel VBA macro to generate .rtf file
- Next Thread: editing data in database using flexgrid
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





