fdvvc
Printable View
fdvvc
Can U plz Attach The Screenshot Of Ur Form For Better Undersanding.......
xcdsd
When an Adult or Kid option is changed, mathematically you need to subtract the cost of the previous choice and then add in the cost of the new choice.
The easiest method is to simply recalculate the total which the current code does do (except for the OptA1_Click and OptK3_Click events) but it adds the previous total to itself and then adds in the new total. All you need is
or simplyCode:sngCost = (sngKids * LblKidsPrice) + (sngAdults * LblAdultsPrice)
intTotal = sngCost
Hint: Anytime you start repeating the same code in multiple procedures it is time to move the repetitive code into its own procedure. Then Call the procedure from multiple places.Code:intTotal = (sngKids * LblKidsPrice) + (sngAdults * LblAdultsPrice)
jpojpo
the two text boxes that u have shown One for Adults And Other For kids What do U want to Show in that text boxes the the total cost of total adults and in other one the total cost of kids....is it???
Try to store The Adults total cost in other variable Rather than intTotal and kids Total cost in intTotal
Can anyone help me with this? I cant getmy head around how to display both prices as a total.
Thanks
hjhi
1. Recommend typing this at the top of your form: Option Explicit
2. Press Ctrl+F5 to run your project. Any errors? If so, fix those first and repeat Ctrl+F5 until your project loads without any errors.
3. What is intTotal declared as? An integer? If so, setting it to a Single vartype variable (i.e., sngAdultColst) you will lose any partial pound amounts.
4. When coding for money, I'd generally recommend using Currency vs Single.
5. You are using your Labels and Textbox values without ensuring they are numeric from what I can see. It is best to convert all strings to numeric variable types before performing math on them, i.e., use Val(), CCur(), CDbl(), CSng(), CLng(), etc.
j0oido
What's going on...???? :confused::sick::ehh:
I dont think he will be getting any more help either.