Progress menu with popup? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Progress menu with popup?

Pure1108Pure1108 Posts: 4Member
I've made a working progress bar but I'm trying to make it show a message showing 'loading complete' or something when it is 100% finished.

I tried[code] Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
ProgressBar1.Increment(10)

If ProgressBar1.Value = ProgressBar1.Maximum Then

MsgBox("Loading complete.")


End If




End Sub[/code]

but this resulted in the message opening constantly and when they are all closed they stop opening?

Doesnt make sense >.<

EDIT: well, it does make sense but what i mean is i don't know how else to do this >.<

Comments

  • DaiMitnickDaiMitnick Posts: 77Member
    It keeps opening because each time the timer ticks, it is finding that the progress bar is full and therefore opens a messagebox as instructed. You need to either stop the timer once complete, or use a public variable (boolean is best) to tell it when to stop. So you could use this:

    [code]
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    ProgressBar1.Increment(10)
    If ProgressBar1.Value = 100 Then
    Timer1.Stop()
    MsgBox("Loading complete.")
    End If
    End Sub
    [/code]

    Or this:
    [code]
    Public boolFin As Boolean

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    If boolFin = False Then ProgressBar1.Increment(10)
    If ProgressBar1.Value = 100 Then
    If BoolFin = False Then MsgBox("Loading complete.")
    BoolFin = True
    End If
    End Sub
    [/code]

    HTH, Dai


    ------------------------------------------
    Do or do not, there is no try. |
    ------------------------------------------
Sign In or Register to comment.