Datagrid Please Help - Cant get it to work :(
Hey Guys, I'll try to explain it a little better.
String Category Will equal say "£29.00" at startup
But i cannot parse it into an Int because of the £
So if i try to substring category – string removePoundSign = category.substring(1, category.length – 1) it shows "29.00" which is what I want but then if i do the if statement
Then i turn that into an Int
Int myValue
Int32.TryParse(removePoundSign, out myValue)
If (myValue >= 20)
{ e.appearence.backcolor = colour.red;
}
It won't work because it's still looking at the grid and seeing "£29.00"
As i was saying I can remove the display format and get rid of the £ and it works but i was wondering whether there is a way of doing it and keeping the £
Thanks alot
private void gridView1_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
{
GridView View = sender as GridView;
string category = View.GetRowCellDisplayText(e.RowHandle, View.Columns["Creditamount"]);
string removePoundSign = category.Substring(1, category.Length - 1);
int numValue;
Int32.TryParse(removePoundSign, out numValue);
if (numValue >= 90)
{
e.Appearance.BackColor = Color.Red;
e.Appearance.BackColor2 = Color.SeaShell;
}
}