VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Example that shows how to set up a simple Progress Bar

by Capp00 (8 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 26th June 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Example that shows how to set up a simple Progress Bar

API Declarations


Dim MaxNum As Integer


Rate Example that shows how to set up a simple Progress Bar



'You will be able to change the max value for the progress bar
'at runtime instead of just setting a value.
'This is one of the easiest things you can do with VB but
'its potential is great for user friendlyness.
'***************************
'Created and test in VB 6 by Andy P.
'***************************
'start a new standard project
'add a command button (command1)
'add a text box (text1)
'add a label (label1)
'add a progress bar (pgb1)
'add a timer (timer1)
'Then add this code to the form


Private Sub Command1_Click()
    Timer1.Enabled = True  'activates the timer
    maxNum = Text1.Text    
    pgb1.Max = maxNum      'Sets the max value of the progress bar
End Sub

Private Sub Form_Load()
   intnum = 0            'initializes the number at 0
   Timer1.Enabled = False  'deactives the timer until told otherwise
End Sub


Private Sub Timer1_Timer()
  If intnum < maxNum Then    'checks to see current count of text
    intnum = intnum + 1
    Label1.Caption = intnum & "  Of" & " " & maxNum
    pgb1.Value = intnum      'increases count on progress bar
  End If
End Sub

'then run it, it will no do anything until you enter
'a value into the text box and hit enter
'any questions/comments? email me


Download this snippet    Add to My Saved Code

Example that shows how to set up a simple Progress Bar Comments

No comments have been posted about Example that shows how to set up a simple Progress Bar. Why not be the first to post a comment about Example that shows how to set up a simple Progress Bar.

Post your comment

Subject:
Message:
0/1000 characters