Hi all,
I am currently trying to filter my data grid view using combo boxes. I want what ever is selected in the combo box to filter shown in the data grid view. Im using and OLEDB connection to and excel sheet. im having trouble showing the filtered results in the data grid view, so basically there are string values with a column called " Type " and I want to filter this column with what ever is selected within the combo box say " CLASSIC " and only show the results for this or any other selection made within the combo box? I need some help with this iv included my code that I am using at the moment please inform me for better ways of overcoming this problem. Thanks.
code:
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { DataView DV = new DataView(dt); string selected = (string)comboBox1.SelectedItem; if (selected == "CLASSIC") { DV.RowFilter = string.Format(" Type like '%" +comboBox1.Text+"%'"); dataGridView1.DataSource = DV; dataGridView1.Refresh(); } else if (selected == "ROBUST") {
Anay help would be appreciated thanks
regards
Ky_EX