Click here to Skip to main content
14,267,679 members
Rate this:
Please Sign up or sign in to vote.
See more:
 private void comboName_TextChanged(object sender, EventArgs e)
        {              
                DataView DV = new DataView(tableBooks);
                DV.RowFilter = @"name like '%" + comboName.Text + "%'";                               
                dataBooks.DataSource = DV;  
        }
private void comboTitle_TextChanged(object sender, EventArgs e)
        {
                DataView DV = new DataView(tableBooks);
                DV.RowFilter = @"title like '%" + comboTitle.Text + "%' ";
                dataBooks.DataSource = DV;
        }        

Hello,
I have a DataGridView with multiple columns.
I have 2 combo boxes that would each filter the DataGrid by the specific columns (one for name, one for title).
The filter works fine when selecting only one combo box (first or second), but when I try to filter using both (a specific name from combobox1 and a specific title from combobox2), the second combobox doesn`t take into account what I`ve selected for first (and is like I`m using only one combobox).

I am asking for some help, please, because I can`t figure how to do it.
Thank you...
Posted

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

There is a codeproject article on this very subject Datagridview with filtering capability[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100