Hi,
I am performing math calculations on grid. Some columns have negative numbers from the time the grid loads and some column values keep changing when the cell value in other column changes.
I need to show the negative numbers in red. Right now I have written the code within the initialize row event and also within cell change event to show the negative numbers in red. It is performing fine sometimes and not showing well sometimes.
Is there any other better way to carry out this one??
The way you are doing it sounds correct.
What's the problem? What does "not showing well sometimes" mean?
This is the code I used in Initialize Row event of the grid and also in cell change event
If CDec(e.Row.Cells(i).Value.ToString) < 0.0 Then e.Row.Cells(i).Appearance = NegativeAppearance Else e.Row.Cells(i).Appearance.ForeColor = Color.Black End If
NegativeAppearance is an appearance object where forecolor and forecolordisabled color set to red.
This works fine when the form is showing values for the first time but when I change some data and some field values become negative from positive then it is not showing me the modified one in red.