Create a DataView and Bind the grid to it (I'm assuming you want to do this
programatically, not just filter it so only BET shows and the user then
deletes it via the ui)
Ok, so you have a datatable dt
DataView dv = dt.DefaultView;
DataGrid1.DataSource = dt;
Ok, so no we have the thing bound to the view instead of the datatable.
Object[] searchValue = new Object[1];
dv.Sort = "Test2";
searchValue[0] = "BET";
int i = dv.Find(searchValue);
dt.Rows[i].Delete();
If you want more values to find, then just change the size of the arrray and
then add the additional values.
Now, if you wanted to just show the Row(s) with BET, in the grid, you could
just set the RowFilter.. dv.RowFilter = "Test2 = BET" ; and then the grid
would now only show the Row or rows with BET in Test2.
Does this help?
"NewBie" <an*******@discussions.microsoft.com> wrote in message
news:CC**********************************@microsof t.com...
i have created a datatable and bind it to my datagrid1 to .
how can i delete rows by content.
for example
i have 3 column test1 test2 test3 with a number of rows, lets say 5.
in one of these cells of column TEST2 there is a value of "BET" in it .
How can i find it and delete that row?
Thanks