populating datagrid based on a query output
-
Hi guys, I'm using a form in vb.net that has few textboxes and a combobox and a datagrid... my problem is based on a selected combobox value (which is actually an order number) I need to populate the datagrid with selected rows and columns that satisfy the query criteria... (say only those rows that has the same order number as selected in the combobox... and also say 4 column out of 10) I'm not sure how u can do this ... Any clue any suggestion is welcomed... thanks
-
Hi guys, I'm using a form in vb.net that has few textboxes and a combobox and a datagrid... my problem is based on a selected combobox value (which is actually an order number) I need to populate the datagrid with selected rows and columns that satisfy the query criteria... (say only those rows that has the same order number as selected in the combobox... and also say 4 column out of 10) I'm not sure how u can do this ... Any clue any suggestion is welcomed... thanks
You can set the RowFilter of the Datagrid in the ComboBox SelectedIndexChanged event. Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged 'ur selected order no m_orderNo = Integer.Parse(CType(ComboBox1.SelectedValue, String) CType(DataGrid1.DataSource, DataTable).DefaultView.RowFilter = "orderno = " + m_orderNo.ToString() End Sub