Visual Basic: Basic Progressbar (Buttons + Timer)
Welcome to today's blog post and vLog for programming tutorials. Today we are going to learn how to create a very simple progress bar in Visual Basic, and it will also introduce you to some key items that will be building up to the advanced progress bar tutorial.
For this tutorial you are going to need,
- Button1 - "Start"
- Button2 - "Stop"
- Timer1
- ProgressBar1
You can setup your form the same way I have it above in the header image, or however you would like it to be. To learn more about this tutorial, watch my YouTube video below to see the step by step or simply grab the source code below the video itself.
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- 'start
- Timer1.Start()
- End Sub
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- 'stop
- Timer1.Stop()
- End Sub
- Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
- ProgressBar1.Increment(+1)
- If (ProgressBar1.Value = 100) Then
- If (CheckBox1.Checked = True) Then
- Timer1.Stop()
- ProgressBar1.Value = 0
- End If
- End If
- End Sub
That is all for today,
hope you enjoyed this tutorial.
0 comments :
Post a Comment