Results 1 to 9 of 9

Thread: Need help with boolean

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    9

    Need help with boolean

    Here is a snippet

    If total.Value = 1073741824 Then tb.Text = "test"


    What i want this to do,is when TOTAL reaches 1073741824 it will change the text in the text box,Why isnt this working? it will run no problem it just wont change the text box.

    Also,how can i make the program automatically plus 1 to the existing number in the text box when the Amount is reached?
    Last edited by neodude112320; Nov 12th, 2007 at 05:56 AM.

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

    Re: Need help with boolean

    That code does what it does, but if it's not executed in a useful place then what it does is useless. Where is it executed? We need context.
    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

  3. #3
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Post Re: Need help with boolean

    As jmcilhinney said, we need a little more info.

    You can add a messagebox into your code. That will pop up and tell you WHEN the value has been calculated to that amount.

    Code:
    If total.Value = 1073741824 Then 
      tb.Text = "test"
      MsgBox("test")
    End If
    If you don't see the message box, then it never reaches that number.
    .
    ~Peter


  4. #4
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Need help with boolean

    Quote Originally Posted by MrGTI
    As jmcilhinney said, we need a little more info.

    You can add a messagebox into your code. That will pop up and tell you WHEN the value has been calculated to that amount.

    Code:
    If total.Value = 1073741824 Then 
      tb.Text = "test"
      MsgBox("test")
    End If
    If you don't see the message box, then it never reaches that number.
    .
    That method was used before there were proper debug tools. Visual Studio provides excellent debugging, use a breakpoint instead
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    9

    Re: Need help with boolean

    Ok,Here is exactly where it is:

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    total.Value = bytes.RawValue
    TextBox1.Text = bytes.RawValue

    If total.Value = 1073741824 Then
    tb.Text = "test"
    End If


    End Sub
    End Class

    And it still wont change the text in tb.

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

    Re: Need help with boolean

    Are you sure the Timer is Enabled? If it is then presumably total.Value never actually equals that value.
    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

  7. #7
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Need help with boolean

    What datatype is total.value?
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  8. #8

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    9

    Re: Need help with boolean

    The Timer is enabled and working,Total is the name for my progress bar,Value gets or sets the progress of the bar.

  9. #9
    Addicted Member ThatSamiam's Avatar
    Join Date
    Apr 2007
    Posts
    128

    Re: Need help with boolean

    Could your number accumulator (total) be incementing faster than your timer polls for its value?

    Somehow you should tie an event to the changing of total and check the value there.

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