DataGrid Filter

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Hi all,
I have a DataTable and a DataGridView that is using it as a datasource.
I'm using the DataTable.Select method and I can find some rows. Is it now
possible, somehow to use the result of the Select method (a DataRow
collection) to make the DataGridView filtering only on those rows? I mean to
display only the found rows and after that to select all previous rows back
again? I want to use two buttons on my form "Apply Filter" and "Clear
Filter" to accomplish this.

Thanks for your time.
Paul
 
HI THERE

AFTER CONNECTION TO DATABASE AND FILLING DATASET, TRY THIS :

Dim dv As DataView
' HERES THE FILTER AT FIELDNAME THEN ORDER ASC/DESC

dv = New DataView(ds.Tables("TABNAME"), "FIELTNAME like '%'", "FIELDNAME
ASC", DataViewRowState.CurrentRows)
DG1.DataSource = dv
DG1.Refresh()
 
Back
Top