viper5646
Active member
Hi all
I have a datagridview where one of the columns display the amount.
I have been trying to change the color of the amount to red if the value is 0 or negative.
With all my tries have been negative.
With the following Code I receive This error
Thanks
I have a datagridview where one of the columns display the amount.
I have been trying to change the color of the amount to red if the value is 0 or negative.
With all my tries have been negative.
With the following Code I receive This error
"NullRefferenceException was unhandled".
VB.NET:
Private Sub redifnegative()
For x As Integer = 0 To (Utilitiesgridview.RowCount) - 1
Dim w As Double = CDbl(Utilitiesgridview.Rows(x).Cells(1).FormattedValue)
If w < 0 Then
Utilitiesgridview.Rows(x).Cells(1).ContextMenuStrip.ForeColor = Color.Red
End If
Next
End Sub