Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have DataGridView that Contains Some Details , I want filter these Data using 4

ComboBoxes .

Thanks For All

I'M Sorry Because My Poor English


This Is An Example
http://www.gulfup.com/?kWMojY[^]
Posted
Comments
Ahmed Dabas 14-Oct-14 14:43pm    
my previous post was closed because I could not express

This becomes a design issue. I find that it is best to have the 4 combos and a button that applies the filtering. In the click event of the button you apply the filtering to the underlying data collection based on the selected items of the combo boxes.

The button allows the user to select from each combo and then apply the filter. If you use the change event of the combo's the filtering is prematurely applied based on only the current combo!
 
Share this answer
 
Comments
Ahmed Dabas 15-Oct-14 14:53pm    
i want to use change event
Mycroft Holmes 15-Oct-14 18:23pm    
Then accept that the filter will be fired EVERY time the user changes any of the 4 values!
Ahmed Dabas 16-Oct-14 4:11am    
yes i want this
Ahmed Dabas 16-Oct-14 11:56am    
How can i do this
If you want to do the filtering every time a user changes a combobox selection you need to:

Add an event handler to each combobox for the OnChangeEvent (change to the event view in the properties window and double click on the OnChange)

In each event handler:
Get the selected value from the combobox
Filter the collection populating the datagridview
Note you may need to update the binding of the DGV.

You really need to try and help yourself!
 
Share this answer
 
No one can help me ,
Some one help me
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900