I have an instance of System.Windows.Forms.CheckedListBox which displays a list of tick boxes and I have some other System.Windows.Forms objects in my application. I would like to, depending on what the user selects using the other System.Windows.Forms items, show or hide different items in the System.Windows.Form.CheckedListBox. How could I achieve this?
Note: this is for a windows desktop application, not a webpage.
There is no easy way to hide an item in a
CheckedListBox, you have to remove it, like Brendan Vogt showed you.An alternative is to take advantage of data binding. It is not supposed to work for
CheckedListBox, the documentation of theDataSourceproperty says:However, I used it in the past, and it works fine. So if you assign a
DataViewas theDataSourcefor the list, you can filter its items using theRowFilterproperty