ScrollBars Property
Collapse the table of content
Expand the table of content

DataGridView.ScrollBars Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets the type of scroll bars to display for the DataGridView control.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in

public ScrollBars ScrollBars { get; set; }
/** @property */
public ScrollBars get_ScrollBars ()

/** @property */
public void set_ScrollBars (ScrollBars value)

public function get ScrollBars () : ScrollBars

public function set ScrollBars (value : ScrollBars)

Property Value

One of the ScrollBars values. The default is Both.

Exception typeCondition


The specified value when setting this property is not a valid ScrollBars value.


The value of this property cannot be set because the DataGridView is unable to scroll due to a cell change that cannot be committed or canceled.

Regardless of the value of this property, scroll bars are shown only when they are needed. Use this property to prevent scroll bars from appearing. This is useful, for example, when you want to provide an alternative user interface (UI) for scrolling.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

© 2015 Microsoft