Get the latest news, exclusives, sport, celebrities, showbiz, politics, business and lifestyle from The VeryTime,Stay informed and read the latest news today from The VeryTime, the definitive source.

How to Make a Repeating Progress Bar in VB

38
    • 1). Launch Microsoft Visual Studio, click "New Project" from the left pane of your computer screen, and expand "Visual Basic" below "Installed Templates." Click "Windows" and double-click "Windows Forms Application" from the center of the dialog window to create a new project.

    • 2). Double-click "ProgressBar" from the "Toolbox" pane to add a new progress bar control. Double-click "Button" to add a new button to the form. Add a second button.

    • 3). Double-click "Button1" to create a new button click event. Add the following code to create a loop to repeat the progress bar until the user clicks the second button:

      Dim xCntr As Integer

      xCntr = 1

      userWantsToStop = False

      Me.ProgressBar1.Minimum = 0

      Me.ProgressBar1.Maximum = 1000

      Do While (userWantsToStop = False)

      Me.ProgressBar1.Value = xCntr

      Application.DoEvents()

      System.Threading.Thread.Sleep(1)

      If (xCntr = 1000) Then

      xCntr = 1

      End If

      xCntr = xCntr + 1

      Loop

    • 4). Switch back to Form Design view and double-click "Button2" to create a click event for this button. Add the following code to reset the progress bar and stop the while loop in the previous step:

      userWantsToStop = True

      Me.ProgressBar1.Value = 0

    • 5). Press "F5" to run the program and click "Button1" to start repeating the progress bar. Click "Button2" to stop it.

Source...
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.