FORM_LOAD
For i As Integer = 0 To Me.DataGridView1.Columns.Count - 1
Me.DataGridView1.Columns(i).Name = Me.DataGridView1.Columns(i).DataPropertyName
Next
Private Sub dataGridView1_CellFormatting(ByVal sender As Object, _
ByVal e As DataGridViewCellFormattingEventArgs) _
Handles DataGridView1.CellFormatting
If Me.DataGridView1.Columns(e.ColumnIndex).Name = "SHORT_NAME" Then
If e.Value IsNot Nothing Then
' If the value of the cell is "Inactive" AND this form's inactiveCustomersCheckBox control is checked..
If e.Value.ToString = "LHH" Then
' Set the BackColor of the cell to yellow.
e.CellStyle.BackColor = Color.Red
ElseIf e.Value.ToString = "LLH" Then
e.CellStyle.BackColor = Color.Yellow
ElseIf e.Value.ToString = "LLO" Then
e.CellStyle.BackColor = Color.Red
Else
e.CellStyle.BackColor = Color.White
End If
End If
End If
End Sub
link:
"http://www.devx.com/dotnet/Article/34845/0/page/3
Realted Links:
www.devx.com/dotnet/Article/33748
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment