DataGridView.RowHeadersBorderStyle Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets or sets the border style of the row header cells.

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

Public Property RowHeadersBorderStyle As DataGridViewHeaderBorderStyle

Exception Condition

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


The specified value when setting this property is Custom.

If the RowHeadersBorderStyle property is set to anything other than Single, the GridColor property must be a system color.

You cannot set this property to the Custom value, which is a read-only value indicating that the border style has been customized through the use of the AdvancedRowHeadersBorderStyle property.


If visual styles are enabled for the application through the Application.EnableVisualStyles method and the EnableHeadersVisualStyles property is true, the row headers are painted using the current theme. In this case, the value of the RowHeadersBorderStyle property is ignored for all row headers except the TopLeftHeaderCell, to which the theme is not applied.

The following code example illustrates the use of this property.

Private Sub SetBorderAndGridlineStyles()

    With Me.dataGridView1
        .GridColor = Color.BlueViolet
        .BorderStyle = BorderStyle.Fixed3D
        .CellBorderStyle = DataGridViewCellBorderStyle.None
        .RowHeadersBorderStyle = _
        .ColumnHeadersBorderStyle = _
    End With

End Sub

.NET Framework
Available since 2.0
Return to top