vb.net Code:
Private Sub DataGridView1_CellPainting(sender As System.Object, e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles DataGridView1.CellPainting Dim c As Drawing.Color For i = 0 To DataGridView1.Rows.Count - 1 Select Case CInt(DataGridView1.Rows(i).Cells(0).Value) Case 1 c = Color.AliceBlue Case 2 c = Color.Bisque Case 3 c = Color.Coral Case Else c = Color.White End Select DataGridView1.Rows(i).Cells(0).Style.BackColor = c Next End Sub




Reply With Quote