Visual Basic - Progress Bar reset automatically

Asked

Viewed 135 times

0

Goodnight!

I’m doing a program in Visual Basic, and I need my Progress Bar to go back to 0 automatically when it reaches 100, and my timer will stop when the Progress Bar Value reaches 100.

Can someone help me?

Program Code

Public Class DevKit
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Dinheiro.Click

End Sub

Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Experiencia.Click

End Sub

Private Sub ProgressBar1_Click(sender As Object, e As EventArgs) Handles RPGMakerBar.Click

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles RPGMaker.Click
    Timer1.Start()
End Sub

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
    RPGMakerBar.Increment(1)
    If RPGMakerBar.Value = 100 Then
        QtdDinheiro.Text = QtdDinheiro.Text
    End If
    PctRPGMaker.Text = RPGMakerBar.Value & (" %")

End Sub

Private Sub Label1_Click_1(sender As Object, e As EventArgs) Handles PctRPGMaker.Click

End Sub
End Class

1 answer

0

Add the following code within the function

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
    RPGMakerBar.Increment(1)
    If RPGMakerBar.Value = 100 Then
        QtdDinheiro.Text = QtdDinheiro.Text
        Timer1.Stop()
        RPGMakerBar.Value = 0
    End If
    PctRPGMaker.Text = RPGMakerBar.Value & (" %")

End Sub

Browser other questions tagged

You are not signed in. Login or sign up in order to post.