CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2009
    Posts
    5

    VB6 Help- Text box not working

    hey im new here and I was wodering if you guys can help me... this is what I have

    Im trying to make a progressbar start when I press the start buttonand when the progressbar reaches 100 on the textbox it adds

    "Its Done!"

    on my commandbox I have

    timer1.enabled = True


    And my timer1 is enabled.
    in my timer1 I have
    progressbar1.Value = val (Progressbar1.value) + val(5)

    or sumething like that. But it works fine.

    What I need now is that when the progressbar reaches 100 this will add to the textbox:

    "Its Done!"

    plus what ever is written on it. But if i write this

    if progressbar1.value = 100 then
    text1.text = text1.text & "Its Done!"
    end if

    but it will keep adding "Its Done!" and it will never finish. How can I make it type only one time? Thnx

  2. #2
    Join Date
    Aug 2005
    Location
    Imperial College London, England
    Posts
    490

    Re: VB6 Help- Text box not working

    Welcome to the Forums
    You need to stop your timer.
    Just add
    Code:
    Timer1.enabled = False
    inside that if statement.

    Happy Coding
    ~Jawa
    Help from me is always guaranteed!*
    VB.NET code is made up on the spot with VS2008 Professional with .NET 3.5. Everything else is just made up on the spot.
    Please Remember to rate posts, use code tags, send me money and all the other things listed in the "Before you post" posts.

    *Guarantee may not be honoured.

  3. #3
    Join Date
    Jan 2009
    Posts
    5

    Re: VB6 Help- Text box not working

    Quote Originally Posted by javajawa View Post
    Welcome to the Forums
    You need to stop your timer.
    Just add
    Code:
    Timer1.enabled = False
    inside that if statement.

    Happy Coding
    ~Jawa

    I tried that and it didnt work. ill be posting my file.

  4. #4
    Join Date
    Jan 2009
    Posts
    5

    Re: VB6 Help- Text box not working

    Code:
    Private Declare Function GetVolumeInformation Lib "Kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
    
    Private Sub alertpay_Click()
    Dim strLink As String
    strLink = "http://www.alertpay.com"
    Shell "c:\program files\internet explorer\iexplore " & strLink
    End Sub
    Private Sub Command1_Click()
    Timer1.Enabled = True
    If Command1.Enabled = True Then
    Command1.Caption = "Sending info..."
    End If
    Command1.Enabled = False
    Text1.Text = Text1.Text & "    Sending your HWID to our sever.    This is will take less than 1 min."
    
    End Sub
    
    Private Sub exit_Click()
    Unload Me
    End Sub
    
    Private Sub form_load()
        Dim Serial As Long, VName As String, FSName As String
        'Create buffers
        VName = String$(255, Chr$(0))
        FSName = String$(255, Chr$(0))
        'Get the volume information
        GetVolumeInformation "C:\", VName, 255, Serial, 0, 0, FSName, 255
        'Strip the extra chr$(0)'s
        VName = Left$(VName, InStr(1, VName, Chr$(0)) - 1)
        FSName = Left$(FSName, InStr(1, FSName, Chr$(0)) - 1)
        Text1.Text = "Your computer HWID is:" + Trim(Str$(Serial)) + " "
    End Sub
    
    Private Sub google_Click()
    Dim strLink As String
    strLink = "https://www.google.com/accounts/ServiceLogin?service=sierra&continue=https%3A%2F%2Fcheckout.google.com%2F%3Fupgrade%3Dtrue&hl=en&nui=1&ltmpl=default"
    Shell "c:\program files\internet explorer\iexplore " & strLink
    End Sub
    
    Private Sub help_Click()
    Dim strLink As String
    strLink = "http://www.n-vision.org"
    Shell "c:\program files\internet explorer\iexplore " & strLink
    End Sub
    
    Private Sub HWID_Click()
    Dim strLink As String
    strLink = "http://www.n-vision.org/forum/showthread.php?t=5"
    Shell "c:\program files\internet explorer\iexplore " & strLink
    End Sub
    
    Private Sub info_Click()
    Form2.Show
    End Sub
    
    Private Sub paypal_Click()
    Dim strLink As String
    strLink = "http://www.paypal.com"
    Shell "c:\program files\internet explorer\iexplore " & strLink
    End Sub
    
    Private Sub Timer1_Timer()
    If ProgressBar1.Value = 100 Then
    ProgressBar1.Value = 100
    Else
    ProgressBar1.Value = Val(ProgressBar1.Value) + Val(10)
    End If
    Label4.Caption = ProgressBar1.Value
    If ProgressBar1.Value = 10 Then
    Command1.Caption = "Downloading..."
    End If
    If ProgressBar1.Value = 100 Then
    Command1.Caption = "Done."
    End If
    End Sub
    The only way to make the "Done!" to work is that if I put the code I said in the timer but it keeps looping :
    "Done!"
    "Done!"
    "Done!"
    "Done!"
    "Done!"
    "Done!"
    Last edited by simon66; January 7th, 2009 at 04:42 PM.

  5. #5
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: VB6 Help- Text box not working

    What's the interval of the Timer? <15 doesn't even fire. 1000 is one second (I'd use 500 or 1/2 second)
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  6. #6
    Join Date
    Jan 2009
    Posts
    5

    Re: VB6 Help- Text box not working

    Quote Originally Posted by dglienna View Post
    What's the interval of the Timer? <15 doesn't even fire. 1000 is one second (I'd use 500 or 1/2 second)
    is 1000

  7. #7
    Join Date
    Jan 2009
    Posts
    5

    Re: VB6 Help- Text box not working

    here is the file. once you click update it will say is downloading but dont worry. I took out that option.
    Attached Files Attached Files

  8. #8
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: VB6 Help- Text box not working

    Code:
    ....
    Private Sub Command1_Click()
       Timer1.Enabled = True
       If Command1.Enabled = True Then
           Command1.Caption = "Sending info..."
       End If
       Command1.Enabled = False
       Text1.Text = Text1.Text & "    Sending your HWID to our sever.    This is will take less than 1 min."
     
    End Sub
     
    Private Sub exit_Click()
    Unload Me
    End Sub
     
    ...
     
     
     
    Private Sub Timer1_Timer()
       If ProgressBar1.Value >= 100 Then
          ProgressBar1.Value = 100
          Timer1.Enabled= false
          Command1.Caption = "Done."
       Else
          ProgressBar1.Value = Val(ProgressBar1.Value) + Val(10)
       End If
       Label4.Caption = ProgressBar1.Value
       If ProgressBar1.Value = 10 Then
           Command1.Caption = "Downloading..."
       End If
    End Sub
    Do it this way
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

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

Featured