System.Windows.Forms.ProgressBar.PerformStep Method

Advances the current position of the progress bar by the amount of the ProgressBar.Step property.

Syntax

public void PerformStep ()

Remarks

The ProgressBar.PerformStep method increments the value of the progress bar by the amount specified by the ProgressBar.Step property. You can use the ProgressBar.Step property to specify the amount that each completed task in an operation changes the value of the progress bar. For example, if you are copying a group of files, you might want to set the value of the ProgressBar.Step property to 1 and the value of the ProgressBar.Maximum property to the total number of files to copy. When each file is copied, you can call the ProgressBar.PerformStep method to increment the progress bar by the value of the ProgressBar.Step property. If you want to have more flexible control of the value of the progress bar, you can use the ProgressBar.Increment(int) method or set the value of the ProgressBar.Value property directly.

The ProgressBar.Value property specifies the current position of the System.Windows.Forms.ProgressBar. If, after calling the ProgressBar.PerformStep method, the ProgressBar.Value property is greater than the value of the ProgressBar.Maximum property, the ProgressBar.Value property remains at the value of the ProgressBar.Maximum property. If, after calling the ProgressBar.PerformStep method with a negative value specified in ProgressBar.Step, the ProgressBar.Value property is less than the value of the ProgressBar.Minimum property, the ProgressBar.Value property remains at the value of the ProgressBar.Minimum property.

Because a System.Windows.Forms.ProgressBar object whose style is set to ProgressBarStyle.Marquee displays a continuously scrolling bar instead of its ProgressBar.Value, calling ProgressBar.PerformStep is unnecessary and will raise an InvalidOperationException.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0