Create Loading Process by Visual Basic 6
Do you know progressbar?. Progressbar is a component of Visual Basic that use for loading process. To create this project we need 4 components: a progressbar, a timer and two command buttons. In default condition, progressbar is not show on the toolbox. To show progressbar on the toolbox you must open component menu by click Project menu -> Components or you can also use shortcut key "Ctrl + T". Components windows appears on the screen. Now, you create a progressbar, a timer and two command buttons on the form.
1. Click Command1 and look on the Properties windows. Change command1 caption.
Command1.Caption = "Process"2. Command2.Caption = "Clear". Look at first step!
3. Click timer1 and look configuration of Properties - Timer1. Change interval to 10. Increase the value of interval will make loading process slower. Decrease the value of interval will make loading process faster.In the last, you type code below on the Code Windows by click the "View Code" button on Project Explorer or you can download this project.
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
ProgressBar1.Value = 0
Label1.Caption = ProgressBar1.Value
End Sub
Private Sub Timer1_Timer()
If ProgressBar1.Value = ProgressBar1.Max Then
Timer1.Enabled = False
Exit Sub
End If
ProgressBar1.Value = ProgressBar1.Value + 1
Label1.Caption = ProgressBar1.Value & " %"
End Sub
1. Click Command1 and look on the Properties windows. Change command1 caption.
Command1.Caption = "Process"2. Command2.Caption = "Clear". Look at first step!
3. Click timer1 and look configuration of Properties - Timer1. Change interval to 10. Increase the value of interval will make loading process slower. Decrease the value of interval will make loading process faster.In the last, you type code below on the Code Windows by click the "View Code" button on Project Explorer or you can download this project.
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
ProgressBar1.Value = 0
Label1.Caption = ProgressBar1.Value
End Sub
Private Sub Timer1_Timer()
If ProgressBar1.Value = ProgressBar1.Max Then
Timer1.Enabled = False
Exit Sub
End If
ProgressBar1.Value = ProgressBar1.Value + 1
Label1.Caption = ProgressBar1.Value & " %"
End Sub
Comments
Post a Comment