ProgressBar in Visual Basic .NET

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013

This lesson describes the ProgressBar control


ProgressBar

This control let you display a visible indication of its progress during a long task.

As the task proceeds, the ProgressBar fills in from the left to the right, and ideally, the ProgressBar is completely full when the task finishes.

Its Minimum and Maximum properties determine the range, so when the control's Value property equals its Minimum property, the control is completely blank, and when its Value property equals its Maximum property, the control is completely filled.

Minimum and Maximum

By default, the Minimum and Maximum are set to 0 and 100, respectively, so the Value property indicates the percentage of the task that is complete. However, you can set these properties to any values that make sense for the application. For example, if a program should send 150 email messages, you could set these properties to 0 and 150. As it sends the messages, you set the ProgressBar control's Value property to the number of messages it has sent.

In addition, you can set the Step property instead of setting the Value property. Then you can call the ProgressBar control's PerformStep method to increment the Value (e.g. if the Step is set to 2 the Value will be incremented by 2 each time you call the PerformStep)

    For x As Integer = 1 To 150
        ' send an E-mail     
        SendEmail(x) ' method that sends messages
    
        ' Perform the increment on the ProgressBar.
        ProgressBar1.PerformStep()
    Next


Note: Minimum, Maximum, Value, and Step properties are all integers and they can't accept other data type.

Previous Lesson | Next Lesson


Share This

Home | About | Contact | Privacy Policy

Copyright visual-basic-tutorials.com 2017 - All Rights Reserved.