Dear Experts,
I have a datagridview having multiple rows with the following structure:
|ID| Name| Address | StatusCode |
I would like to paint an ID cell if the value in the corresponding StatusCode cell is 1.
I only managed to paint the StatusCode cell using the following code:
Private Sub dgCorpResults_CurrentCellChanged(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles dgCorpResults.CellFormatting
' Changes how cells are displayed depending on their columns and values.
' Set the background to red for values 1 in the StatusCode column.
If dgCorpResults.Columns(e.ColumnIndex).Name.Equals("StatusCode") Then
If CInt(e.Value) = 1 Then
e.CellStyle.BackColor = Color.Red
e.CellStyle.SelectionBackColor = Color.DarkRed
End If
End If
End Sub
Thanks for helping me out!
Misko
I have a datagridview having multiple rows with the following structure:
|ID| Name| Address | StatusCode |
I would like to paint an ID cell if the value in the corresponding StatusCode cell is 1.
I only managed to paint the StatusCode cell using the following code:
Private Sub dgCorpResults_CurrentCellChanged(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles dgCorpResults.CellFormatting
' Changes how cells are displayed depending on their columns and values.
' Set the background to red for values 1 in the StatusCode column.
If dgCorpResults.Columns(e.ColumnIndex).Name.Equals("StatusCode") Then
If CInt(e.Value) = 1 Then
e.CellStyle.BackColor = Color.Red
e.CellStyle.SelectionBackColor = Color.DarkRed
End If
End If
End Sub
Thanks for helping me out!
Misko