Results 1 to 16 of 16

Thread: Need help with my coding

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    14

    Unhappy Need help with my coding

    fdvvc
    Last edited by robotprogrammer; Mar 23rd, 2010 at 11:27 AM. Reason: Added Highlight Tags

  2. #2
    Junior Member
    Join Date
    Feb 2010
    Posts
    21

    Re: Need help with my coding

    Can U plz Attach The Screenshot Of Ur Form For Better Undersanding.......

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    14

    Re: Need help with my coding

    xcdsd
    Last edited by robotprogrammer; Mar 23rd, 2010 at 11:26 AM.

  4. #4
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    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.

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    14

    Re: Need help with my coding

    jpojpo
    Last edited by robotprogrammer; Mar 23rd, 2010 at 11:25 AM.

  6. #6
    Junior Member
    Join Date
    Feb 2010
    Posts
    21

    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???

  7. #7
    Junior Member
    Join Date
    Feb 2010
    Posts
    21

    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

  8. #8

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    14

    Re: Need help with my coding

    Quote Originally Posted by ricky641 View Post
    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

  9. #9

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    14

    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

  10. #10

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    14

    Unhappy Re: Need help with my coding

    hjhi
    Last edited by robotprogrammer; Mar 23rd, 2010 at 11:24 AM.

  11. #11
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  12. #12

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    14

    Re: Need help with my coding

    j0oido

  13. #13
    Member
    Join Date
    Mar 2010
    Posts
    61

    Re: Need help with my coding

    Quote Originally Posted by robotprogrammer View Post
    j0oido
    What the crap.

  14. #14
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Need help with my coding

    Quote Originally Posted by robotprogrammer View Post
    j0oido
    Quote Originally Posted by robotprogrammer View Post
    hjhi
    Quote Originally Posted by robotprogrammer View Post
    Can anyone help me with this? I cant getmy head around how to display both prices as a total.

    Thanks
    Quote Originally Posted by robotprogrammer View Post
    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
    Quote Originally Posted by robotprogrammer View Post
    jpojpo
    Quote Originally Posted by robotprogrammer View Post
    xcdsd
    Quote Originally Posted by robotprogrammer View Post
    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,...

  15. #15
    Lively Member
    Join Date
    Feb 2010
    Posts
    85

    Re: Need help with my coding

    Quote Originally Posted by akhileshbc View Post
    What's going on...????
    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.

  16. #16
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    280

    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
  •  



Click Here to Expand Forum to Full Width