filtering dataset

  • Thread starter Thread starter Guest
  • Start date Start date
Hi Resti,

You can use a DataView:

- Set the combo box's DataSource to the DataTable in the DataSet.
- Set the combo box's DisplayMember property to the appropriate column name
in the DataTable.
- Add a DataView to the form, and set its Table property to the same
DataTable as the combo box's DataSource.
- Bind all controls (except for the combo box) to the DataView.
- In the SelectedIndexChanged event handler for the combo box, change the
DataView's RowFilter property, so that the combo box's DisplayMember is set
to the selected value. For example:

DataView1.RowFilter = "ProductName = '" & ComboBox1.SelectedText & "'"

The BindingContext will automatically refresh the controls that are bound to
the DataView.

Take care,

Eric
 
Hi resti,

You can try this, watch for typos typed here
\\\
dim dv as new dataview = dt.tables(0)
dv.rowfilter = "Myfield = " & combobox1.text
///

I hope this helps?

Cor
 
Back
Top