Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ScrollBar.Value Property

Gets or sets a numeric value that represents the current position of the scroll box on the scroll bar control.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

[BindableAttribute(true)] 
public int Value { get; set; }
/** @property */
public int get_Value ()

/** @property */
public void set_Value (int value)

public function get Value () : int

public function set Value (value : int)

Not applicable.

Property Value

A numeric value that is within the Minimum and Maximum range. The default value is 0.

Exception typeCondition

ArgumentOutOfRangeException

The assigned value is less than the Minimum property value.

-or-

The assigned value is greater than the Maximum property value.

The following example scrolls an image in a picture box. It uses the Value of the scrollbar to redraw a new part of the image whenever the user scrolls. This code example is part of a larger example provided for the ScrollBar class overview.

NoteNote:

For instructions about how to run this example in Visual Studio, see How to: Compile and Run a Complete Windows Forms Code Example Using Visual Studio.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft