-1

Hello every one how i use progress bar without Timer using in vb.net i have try but i dont get the solution please help me

Dim i As Integer

ProgressBar1.Minimum = 0
ProgressBar1.Maximum = 200

For i = 0 To 200
    ProgressBar1.Value = i
    Next

End Sub

khan ali
  • 1
  • 5
  • What progress do you want to indicate with the progress bar? In the sub that changes the status of that progress, you simply increment the progress bar"s value. – preciousbetine Sep 14 '19 at 12:04
  • Have you tried to refresh the ProgressBar1? – user11982798 Sep 14 '19 at 12:51
  • 1
    If you are simply using this as an animation and not to indicate _actual progress_ then a timer is the best way to go. Fast-running loops like this are not supposed to update the user interface. – Visual Vincent Sep 15 '19 at 14:42

2 Answers2

0

Your code should be indeed working properly. Just make sure you're executing the code, for example, on the Form Load event.

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        For i = 0 To 200
            ProgressBar1.Value = i
        Next
 End Sub
Hiimer
  • 11
  • 3
0
Private Sub UpdateProgressBar()
    Static v As Integer
    If v < 200 Then
        v += 10 'This could be any number you want to increment by
    End If
    ProgressBar1.Value = v
End Sub

Call this at intervals from a long running process.

Mary
  • 14,926
  • 3
  • 18
  • 27