Bir class oluştur
' Datagrid satır renklerini belirler
Shared Sub Datagrid_satır_rengi(ByVal dg As DataGridView)
For k As Integer = 0 To dg.Rows.Count - 1 Step 2
dg.Rows(k).DefaultCellStyle.BackColor = Color.LightCyan
Next
For c As Integer = 1 To dg.Rows.Count - 2 Step 2
dg.Rows©.DefaultCellStyle.BackColor = Color.AliceBlue
Next
dg.RowHeadersDefaultCellStyle.BackColor = Color.AliceBlue
dg.ColumnHeadersDefaultCellStyle.BackColor = Color.AliceBlue
End Sub
Çalışma şeklide şu
Formun hoad olayına
Class1.Datagrid_satır_rengi(DataGridView1)