A Revolution
From the Norm,
Towards Greatness
Home » » Visual Basic: Advanced Progressbar (Speed & Auto Stop)

Visual Basic: Advanced Progressbar (Speed & Auto Stop)

Written By Unknown on Tuesday, May 24, 2016 | 4:49 PM

Visual Basic: Advanced Progressbar (Speed & Auto Stop)

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, 
  1. Trackbar
  2. Checkbox function 
  3. Timer interval control 
  4. 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.
  1. Button 1 - "Start"
  2. Button 2 - "Stop"
  3. Timer1
  4. Progressbar1
  5. CheckBox1
  6. 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! 



  1. Public Class Form1
  2.     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  3.  
  4.  
  5.     End Sub
  6.  
  7.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  8.         'start
  9.        Timer1.Start()
  10.  
  11.     End Sub
  12.  
  13.     Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  14.         'stop
  15.        Timer1.Stop()
  16.  
  17.     End Sub
  18.  
  19.     Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
  20.         ProgressBar1.Increment(+1)
  21.  
  22.         If (ProgressBar1.Value = 100) Then
  23.  
  24.             If (CheckBox1.Checked = TrueThen
  25.                 Timer1.Stop()
  26.                 ProgressBar1.Value = 0
  27.             End If
  28.         End If
  29.  
  30.     End Sub
  31.  
  32.     Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
  33.         If (CheckBox1.Checked = TrueThen
  34.             Button2.Enabled = False
  35.  
  36.         Else
  37.             Button2.Enabled = True
  38.         End If
  39.     End Sub
  40.  
  41.     Private Sub TrackBar1_Scroll(sender As Object, e As EventArgs) Handles TrackBar1.Scroll
  42.         Label1.Text = TrackBar1.Value.ToString
  43.         Timer1.Interval = TrackBar1.Value
  44.     End Sub
  45. End Class


Thank you much for taking your valuable time to learn and read / watch my tutorial, 
have an awesome day!

SHARE

About Unknown

0 comments :

Post a Comment