Public Class Form1 Private WithEvents dgv As DataGridView Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load dgv = New DataGridView() dgv.AllowUserToAddRows = False 'dgv.EditMode = DataGridViewEditMode.EditOnEnter dgv.ColumnCount = 5 dgv.RowCount = 100 dgv.Dock = DockStyle.Fill dgv.DefaultCellStyle.BackColor = Color.Yellow dgv.DefaultCellStyle.SelectionBackColor = Color.Khaki Controls.Add(dgv) End Sub Private Sub dgv_CellFormatting(ByVal sender As Object, _ ByVal e As DataGridViewCellFormattingEventArgs) Handles dgv.CellFormatting If e.RowIndex >= 0 AndAlso (e.RowIndex \ 2) Mod 2 = 0 Then e.CellStyle.BackColor = Color.GreenYellow e.CellStyle.SelectionBackColor = Color.LightGreen End If End Sub End Class