DataGrid Filter

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
 
G

Guest

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()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top