VB.Net progress bar control

Visual Basic.Net progress bar control.

Progress bar is one of the most important control of vb.net, this control is used to show loading or remaining percentage or time of any work.

Let`s create a progress bar control.

Step 1 –

Very first we need to drag progress bar control on our form.

 
vb.net progrssbar control

Step 2 –

Second we need to drag a timer control to our form, because we are going to write the code of progress bar inside the timer control.

 
timer control in vb.net

Note – It`s up to your that you want to add labels or not.

Let`s code for progress bar

Public Class Form1
  Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
     Me.Text = "Progressbar control"
     Label1.Text = "Progressbar control"
     Label2.Text = "loading..."
     Label3.Text = "00"
     Label1.Font = New Font("Comic Sans MS", 15, FontStyle.Bold Or FontStyle.Underline)

     'code for timer control.
     Timer1.Enabled = True
     Timer1.Interval = 200
        
    End Sub

 Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
    'Code for progress bar control.
     ProgressBar1.Value = ProgressBar1.Value + 5
     Label3.Text = ProgressBar1.Value 'Code for Label to shoe loading %. 
     If (ProgressBar1.Value = ProgressBar1.Maximum) Then
         Timer1.Enabled = False
     End If
  End Sub
End Class

Output.

 

progressbar control in vb.net