Hi,
I need to display three numeric columns in datagridview so that all the numbers will show 2 digits after the decimal and if the number is negative it will appear in parentheses and in red font.
Right now I am doing that using CellFormatting event of my datagridview but it greatly effects the performance (binding and sorting) when I displaying more then a thousands records.
If sender.Columns(e.ColumnIndex).Name = "BeginQTY" Then
If e.Value IsNot Nothing Then
If CType(e.Value, Double) < 0 Then
e.Value = FormatNumber(e.Value, , , TriState.True)
e.CellStyle.ForeColor = Color.Red
e.CellStyle.SelectionForeColor = Color.Red
End If
End If
End If
Is there any other way to do it? Like create a custom column template or a custom column? I wasn't able to find any working code to solve my problem,
Thanks,
Igor
I need to display three numeric columns in datagridview so that all the numbers will show 2 digits after the decimal and if the number is negative it will appear in parentheses and in red font.
Right now I am doing that using CellFormatting event of my datagridview but it greatly effects the performance (binding and sorting) when I displaying more then a thousands records.
If sender.Columns(e.ColumnIndex).Name = "BeginQTY" Then
If e.Value IsNot Nothing Then
If CType(e.Value, Double) < 0 Then
e.Value = FormatNumber(e.Value, , , TriState.True)
e.CellStyle.ForeColor = Color.Red
e.CellStyle.SelectionForeColor = Color.Red
End If
End If
End If
Is there any other way to do it? Like create a custom column template or a custom column? I wasn't able to find any working code to solve my problem,
Thanks,
Igor