Export (0) Print
Expand All

VScrollBar Class

Represents a standard Windows vertical scroll bar.

For a list of all members of this type, see VScrollBar Members.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Windows.Forms.Control
            System.Windows.Forms.ScrollBar
               System.Windows.Forms.VScrollBar

[Visual Basic]
Public Class VScrollBar
   Inherits ScrollBar
[C#]
public class VScrollBar : ScrollBar
[C++]
public __gc class VScrollBar : public ScrollBar
[JScript]
public class VScrollBar extends ScrollBar

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

Most controls that need scroll bars already provide them and do not require this control. This is true of a multiline TextBox control, a ListBox, and a ComboBox, for example.

You can use this control to implement scrolling in containers that do not provide their own scroll bars such as a PictureBox or for user input of numeric data. The numeric data can be displayed in a control or used in code. The Minimum and Maximum properties determine the range of values the user can select. The LargeChange property determines the effect of clicking within the scroll bar but outside the scroll box. The SmallChange property determines the effect of clicking the scroll arrows at each end of the control.

Example

[Visual Basic, C#, C++] The following example creates and initializes a VScrollBar and adds it to a Form.

[Visual Basic] 
Private Sub InitializeMyScrollBar()
    ' Create and initialize a VScrollBar.
    Dim vScrollBar1 As New VScrollBar()
    
    ' Dock the scroll bar to the right side of the form.
    vScrollBar1.Dock = DockStyle.Right
    
    ' Add the scroll bar to the form.
    Controls.Add(vScrollBar1)
End Sub


[C#] 
private void InitializeMyScrollBar()
 {
    // Create and initialize a VScrollBar.
    VScrollBar vScrollBar1 = new VScrollBar();
    
    // Dock the scroll bar to the right side of the form.
    vScrollBar1.Dock = DockStyle.Right;
    
    // Add the scroll bar to the form.
    Controls.Add(vScrollBar1);
 }
 

[C++] 
private:
    void InitializeMyScrollBar() {
        // Create and initialize a VScrollBar.
        VScrollBar __gc *vScrollBar1 = new VScrollBar();

        // Dock the scroll bar to the right side of the form.
        vScrollBar1->Dock = DockStyle::Right;

        // Add the scroll bar to the form.
        Controls->Add(vScrollBar1);
    };

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Windows.Forms

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

Assembly: System.Windows.Forms (in System.Windows.Forms.dll)

See Also

VScrollBar Members | System.Windows.Forms Namespace | ScrollBar | HScrollBar

Show:
© 2014 Microsoft