System.Windows.Forms.ProgressBar.Increment Method

Advances the current position of the progress bar by the specified amount.

Syntax

public void Increment (int value)

Parameters

value
The amount by which to increment the progress bar's current position.

Remarks

The ProgressBar.Increment(int) method enables you to increment the value of the progress bar by a specific amount. This method of incrementing the progress bar is similar to using the ProgressBar.Step property with the ProgressBar.PerformStep method. The ProgressBar.Value property specifies the current position of the System.Windows.Forms.ProgressBar. If, after calling the ProgressBar.Increment(int) 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.Increment(int) method with a negative value specified in the value parameter, 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.Increment(int) 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