VB.NET Technology

VB.Net Projects

VB.Net Project 1

ProgressBar and Timer Control
Previous Home Next
adplus-dvertising

For explaining Progressbar control we have link it with event so that the value of progress bar can increase, so here i have chosen timer control. And the the value of progressbar control is increment with timer control tick event. Progress bar control is used to hide the backend process so that user can aware of time consumed by back process of that application.

Code for Timer Control Tick Event

Private Sub Timer1_Tick(ByVal sender As System.Object, 
	ByVal e As System.EventArgs) Handles Timer1.Tick
        progressBar1.Visible = True
        progressBar1.Value = progressBar1.Value + 5
        label3.Visible = True
        label3.Text = "Please Wait While we are checking Authentication..."
        If progressBar1.Value = progressBar1.Maximum Then
            If (textBox1.Text = "r4r") AndAlso (textBox2.Text = "r4r") Then
                Timer1.Enabled = False
                progressBar1.Visible = False
                label3.Text = "Welcome!! you are Authorised User."
                progressBar1.Enabled = False
                progressBar1.Value = 0
                groupBox1.Visible = False
            Else
                progressBar1.Enabled = False
                Timer1.Enabled = False
                progressBar1.Visible = False
                progressBar1.Value = 0
                label3.Text = "Sorry!! Username or Password is Wrong."
            End If
        End If
End Sub

Make Progressbar Control Visible Property "false".

Make timer enabled property true on "OK" button click.

timer1.Enabled = True
Previous Home Next