Welcome back to the two part series for the Visual Basic Progressbar, if you are looking for the "Visual Basic: Basic Progressbar (Buttons + Timer)" - that introduces you to this blog post / tutorial, make sure to click on that highlighted link to learn more about it.
Otherwise, today we are going to take things a little step further by actually making things more smoother, automated and while also learning about,
- Trackbar
- Checkbox function
- Timer interval control
- Control of progressbar speed
For this tutorial you are going to be needing the items from the last tutorial, but I will still list them all just in case this is your first time.
- Button 1 - "Start"
- Button 2 - "Stop"
- Timer1
- Progressbar1
- CheckBox1
- TrackBar1
Setup your form anyway you like it, or simply follow my layout. The next step is to simply watch my YouTube video below to get a clear guidance on how to do things, otherwise go grab the source coder under the video and get started!
- Public Class Form1
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- End Sub
- 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
- Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
- If (CheckBox1.Checked = True) Then
- Button2.Enabled = False
- Else
- Button2.Enabled = True
- End If
- End Sub
- Private Sub TrackBar1_Scroll(sender As Object, e As EventArgs) Handles TrackBar1.Scroll
- Label1.Text = TrackBar1.Value.ToString
- Timer1.Interval = TrackBar1.Value
- End Sub
- End Class
Thank you much for taking your valuable time to learn and read / watch my tutorial,
have an awesome day!
0 comments :
Post a Comment