Export (0) Print
Expand All
Expand Minimize

DataGridView.ColumnHeadersVisible Property

Gets or sets a value indicating whether the column header row is displayed.

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

member ColumnHeadersVisible : bool with get, set

Property Value

Type: System.Boolean
true if the column headers are displayed; otherwise, false. The default is true.

ExceptionCondition
InvalidOperationException

The specified value when setting this property is false and one or more columns have an InheritedAutoSizeMode property value of ColumnHeader.

If the ColumnHeadersVisible property is false, a column whose Resizable property is set to true can still be resized in the user interface (UI) by clicking with the mouse cursor anywhere along the right border of the column to be resized.

The following code example populates an unbound DataGridView control and sets the ColumnHeadersVisible property to true to ensure that column headers are displayed.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft