how to add progress bar on button click that i know but how to hide progress bar after it complete till 100% and then on to next form

bcoz i tryd but both form appears togather after clicking on button

plz solve my problem

Recommended Answers

All 2 Replies

See if this helps.

'//-------------- Pre-requisites: 1 ProgressBar, 1 Timer, 1 Button, 2 Forms. --------------\\
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ProgressBar1.Maximum = 100 '// set the Maximum allowed progress.
        Timer1.Start() '// Start the Timer to keep status of ProgressBar.
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Not ProgressBar1.Value = 100 Then ProgressBar1.Value += 25 '// check if not at Maximum to not go over, then add some value.
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If ProgressBar1.Value = 100 Then '// check if ProgressBar is at Maximum Value.
            Timer1.Stop() '// stop the Timer FIRST, then...
            ProgressBar1.Visible = False '// set ProgressBar visibility to False.
            Form2.Show() '// show another Form.
        End If
    End Sub
End Class

It can also be done without a Timer.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Not ProgressBar1.Value = 100 Then ProgressBar1.Value += 25 '// check if not at Maximum to not go over, then add some value.
        If ProgressBar1.Value = 100 Then '// check if ProgressBar is at Maximum Value.
            ProgressBar1.Visible = False '// set ProgressBar visibility to False.
            Form2.Show() '// show another Form.
        End If
    End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'increase progress bar by value of 20
'// check if not at Maximum to not go over, then add some value.
        If Not ProgressBar1.Value = 100 Then ProgressBar1.Value += 20     
    if ProgressBar1.Value = 100 Then '// check if ProgressBar is at Maximum Value.
            ProgressBar1.Visible = False '// set ProgressBar visibility to False.
            Form2.Show() '// show another Form.
        End If
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.