i have a filled GridView, what i want is to check the value in an int column called "Points" which right now is filled with Null values , some cells do have value though , that's given by the user.So it's null until it gets a value.
I want the GridView Row to change color when a Points cell gets a value, So with a quick look i can distinguish which is done and which is not!
I have managed to make an example code work for Name column, but when i tried to check for the Points column i failed :S..
here's the code:
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (this.dataGridView1.Columns[e.ColumnIndex].Name == "Name")
{
if (e.Value != null)
{
try{
string stringValue = (string)e.Value;
stringValue = stringValue.ToLower();
if ((stringValue.IndexOf("nikos") > -1))
{
this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Pink;
}
}catch (InvalidCastException ex){
}
}
}
}
how can i modify it so i can check for the null or int values in the Points column.
Thanks! :D