Click here to Skip to main content
13,560,107 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


2 bookmarked
Posted 17 Mar 2014
Licenced CPOL

Visual Basic Progress Bar control

, 17 Mar 2014
Rate this:
Please Sign up or sign in to vote.
Visual Basic Progress Bar control

Visual Basic Progress Bar control provides the coolest way to show the progress of any background activity. It is a good idea to show the progress to the end user when an application is performing complex or time consuming background tasks. Follow the steps given below to begin with:

  1. Drag and drop a progress bar control ProgressBar1 and button Button1 on the Form Design.
  2. Dock the ProgressBar1 on the bottom side.

    Visual Basic Progress Bar

  3. Go to ProgressBar1 properties and modify Step property value to 15.

    Visual Basic Progress Bar

  4. Open code for Button1_Click event handling sub and paste the following code in it:
  5. Run the application using F5. Now whenever you press the Button1, the progress bar value is incremented to the next step. We had updated the Step property to 15, so every step increases the progress bar by value of 15. Note that PerformStep() method does nothing when ProgressBar1 value is reached to the Maximum. The default value for Maximum is 100.

    Visual Basic Progress Bar

Properties for Visual Basic Progress Bar Control


Style provides three display options for visual appearance:

  1. Blocks: The progress bar is shown in block increments. This option is not usable in modern windows.
  2. Continuous: The progress bar is shown as a continuous bar. This is the most common value of Style property.
  3. Marquee: Sometimes, we are not sure about the exact progress of a background task. In such cases, we use the Marquee style which shows the progress bar as always moving.


This property provides the value of the incremental step when PerfromStep() method is called.


You can control the speed of moving progress bar animation. Default value is 100. The smaller the value, the faster will be the animation speed.

Modifying Value of Visual Basic Progress Bar in Code

Modify the Windows Application code as below:

Public Class Form1
    Dim increment As Integer = 0

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
                 Handles Button1.Click

        increment = increment + 10
        If increment > ProgressBar1.Maximum Then
            increment = ProgressBar1.Maximum
        End If
        ProgressBar1.Value = increment

    End Sub

End Class


  • This code increases the progress bar value by 10 every time Button1 is pressed.
  • Whenever we are modifying the code of progress bar value, we must check whether the assigned value is less than the Maximum. A runtime error or exception will be returned if we assign a value greater than Maximum. The code is self-explanatory for this purpose.
  • Please note that we have not used PerformStep() method in this code.
  • We don’t have to perform value checks while using PerformStep(). It makes the coding much easier. Just define the value of Step property for progress bar and PerformStep() will increase the value by that step. Simple is that!

The post Visual Basic Progress Bar control appeared first on Bubble Blog.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Pakistan Pakistan
A Telecom Engineer, Visual Basic enthusiast and Android news follower. He is contributing to an online blog as content writer and administrator
You can visit him here:

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04 | 2.8.180527.3 | Last Updated 17 Mar 2014
Article Copyright 2014 by Sharjeel_Ahmad
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid