|
-
Feb 17th, 2010, 12:27 PM
#1
Thread Starter
New Member
Need help with my coding
Last edited by robotprogrammer; Mar 23rd, 2010 at 11:27 AM.
Reason: Added Highlight Tags
-
Feb 17th, 2010, 12:57 PM
#2
Junior Member
Re: Need help with my coding
Can U plz Attach The Screenshot Of Ur Form For Better Undersanding.......
-
Feb 17th, 2010, 01:03 PM
#3
Thread Starter
New Member
Re: Need help with my coding
Last edited by robotprogrammer; Mar 23rd, 2010 at 11:26 AM.
-
Feb 17th, 2010, 01:07 PM
#4
Re: Need help with my coding
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
Code:
sngCost = (sngKids * LblKidsPrice) + (sngAdults * LblAdultsPrice)
intTotal = sngCost
or simply
Code:
intTotal = (sngKids * LblKidsPrice) + (sngAdults * LblAdultsPrice)
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.
-
Feb 17th, 2010, 01:17 PM
#5
Thread Starter
New Member
Re: Need help with my coding
Last edited by robotprogrammer; Mar 23rd, 2010 at 11:25 AM.
-
Feb 17th, 2010, 01:37 PM
#6
Junior Member
Re: Need help with my coding
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???
-
Feb 17th, 2010, 01:38 PM
#7
Junior Member
Re: Need help with my coding
Try to store The Adults total cost in other variable Rather than intTotal and kids Total cost in intTotal
-
Feb 17th, 2010, 01:39 PM
#8
Thread Starter
New Member
Re: Need help with my coding
 Originally Posted by ricky641
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???
Sorry no the two labels are linked to the Adodc and display the prices of the kids and adults tickets. the textbox below the two frames displays the total
-
Feb 17th, 2010, 03:33 PM
#9
Thread Starter
New Member
Re: Need help with my coding
Can anyone help me with this? I cant getmy head around how to display both prices as a total.
Thanks
-
Feb 17th, 2010, 04:03 PM
#10
Thread Starter
New Member
Re: Need help with my coding
Last edited by robotprogrammer; Mar 23rd, 2010 at 11:24 AM.
-
Feb 17th, 2010, 07:27 PM
#11
Re: Need help with my coding
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.
-
Mar 23rd, 2010, 11:23 AM
#12
Thread Starter
New Member
Re: Need help with my coding
-
Mar 23rd, 2010, 11:35 AM
#13
Member
Re: Need help with my coding
 Originally Posted by robotprogrammer
j0oido
What the crap.
-
Mar 23rd, 2010, 11:06 PM
#14
Re: Need help with my coding
 Originally Posted by robotprogrammer
j0oido
 Originally Posted by robotprogrammer
hjhi
 Originally Posted by robotprogrammer
Can anyone help me with this? I cant getmy head around how to display both prices as a total.
Thanks
 Originally Posted by robotprogrammer
Sorry no the two labels are linked to the Adodc and display the prices of the kids and adults tickets. the textbox below the two frames displays the total
 Originally Posted by robotprogrammer
jpojpo
 Originally Posted by robotprogrammer
xcdsd
 Originally Posted by robotprogrammer
fdvvc
What's going on...????  
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Mar 24th, 2010, 12:20 AM
#15
Lively Member
Re: Need help with my coding
 Originally Posted by akhileshbc
It looks as though RobotProgrammer has gone through and erased all of his posts both old and new. I don't think he gets how this public forum works.
-
Mar 25th, 2010, 02:44 AM
#16
Hyperactive Member
Re: Need help with my coding
I dont think he will be getting any more help either.
Slower than a crippled Vista
More buggy than a fresh XP install
Look! Down the road, some 50 miles behind the drunken snail.
It's Ubuntu!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|