Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
AlternatingBackColor Property

DataGrid.AlternatingBackColor Property

Gets or sets the background color of odd-numbered rows of the grid.

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

public Color AlternatingBackColor { get; set; }

Property Value

Type: System.Drawing.Color
A Color that represents the alternating background color. The default is the system color for windows (Window).

By default, both the BackColor and the AlternatingBackColor properties are set to the same color. Setting the BackColor property affects only even-numbered rows, while setting the AlternatingBackColor affects only odd-numbered rows.

The following code example sets the AlternatingBackColor to a Color value.

Private Sub ChangeAltBackClr(ByVal myGrid As DataGrid, _
    ByVal myColor As Color)
    myGrid.AlternatingBackColor = myColor
End Sub

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft