I have a WinForm DataGridView as follows where I need to delete rows which having a specific value in a column
In this case I'm using a textfield to type Code and after clicking "Delete" all the rows which having ITM-000001 under column value. I have no clue where to start.
private void deleteClick(object sender, EventArgs e)
{
String code = txtCode.Text;
// CODE HERE
}
It's been a long while since I did anything with Windows Forms (oh, the good ol' days), so excuse me if this is a little off, but you should be able to accomplish this with something like...
for(int v = 0; v < dataGrid1.Rows.Count; v++)
{
if(string.Equals(dataGrid1[0, v].Value as string, "ITM-000001"))
{
dataGrid1.Rows.RemoveAt(v);
v--; // this just got messy. But you see my point.
}
}