Results 1 to 3 of 3

Thread: Can someone explain why this wouldn't work?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2007
    Posts
    330

    Can someone explain why this wouldn't work?

    Code:
                If hr1 >= 1 Then
                    total1 = total1 - (hr1 * 10)
                End If
    So, example if hr1 is 4 then it should minus the value of total1 by 40, if 3 then by 30 etc.
    For some reason it's not working and I don't get why..

  2. #2
    New Member
    Join Date
    Oct 2012
    Posts
    13

    Re: Can someone explain why this wouldn't work?

    I dont see any reason why it wouldnt work unless the values are stored in textboxes...other then that it should work without a problem.

    Can you give us more of the code? Looks like from the copy/paste theres another If/Then statement

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Can someone explain why this wouldn't work?

    Place a breakpoint (F9) at the top of the code and run the project. When execution breaks, use the Autos, Locals and watch windows to examine the values of all relevant variables, properties and expressions. Step through the code line by line (F10) and examine the state as you go. Before each step, determine what you expect to happen and then, after the step, compare that to what actually did happen. If there's a discrepancy then you've found an issue.

    If this process doesn't elucidate the issue for you then post back and, rather than just saying that it doesn't work, explain what actually does happen.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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