Hi to find some value use your underlying data source than searching in a UI element. To search your value you can use
Filter expressions
in your data table or else the
Find
method on the
DataRow
collections. Here is an example how to find using the
select
method on the data table
DataRow[] rows=dt.Select("ProductName='Product1'");
foreach(DataRow row in rows)
{
dt.Rows.Remove(row);
}
(I hope this simple code snippet is not difficult for you to convert to vb.net). The key is just the select method.
where
dt
refers to a data table.Bind the filtered table to the data grid. If you want to remove those rows from the database then get the ids from the filtered rows and construct the delete query.
Even better way create a new
DataView
and use its
RowFilter
which has same syntax as this select method and bind the dataview to the grid. So your original datatable is unaffected. Choice is yours.