Find specific value in A DataGridView
Hi,
Well, I have a DataGridView binded to a TableAdapter and there is an extra empty column named "clmImg" to put an image or color in it.
I want to do the following :
search through the quantity column, if you find a value less than 15 then put a red color "or red image" in the empty column.
I don't know who to write the code. Any help??
Kirtan PatelPosted Aug 16, 2009, 8:23 AM
that will result in what you want :)
foreach (DataGridViewRow r in dataGridView1.Rows)
{
if (Convert.ToInt32(r.Cells["quantity"].Value) < 15)
{
r.Cells["quantity"].Style.BackColor = Color.Red;
}
}
Kirtan PatelPosted Aug 16, 2009, 9:52 AM
by the way you can also call it will index
happy Coding :)
have n nice day :)
rania MagdyPosted Aug 16, 2009, 8:49 AM