c# - How do I hide/show items in a CheckedListBox? -
i have instance of system.windows.forms.checkedlistbox displays list of tick boxes , have other system.windows.forms objects in application. to, depending on user selects using other system.windows.forms items, show or hide different items in system.windows.form.checkedlistbox. how achieve this?
note: windows desktop application, not webpage.
there no easy way hide item in checkedlistbox, have remove it, brendan vogt showed you.
an alternative take advantage of data binding. not supposed work checkedlistbox, documentation of datasource property says:
this api supports .net framework infrastructure , not intended used directly code.
gets or sets data source control. property not relevant class.
however, used in past, , works fine. if assign dataview datasource list, can filter items using rowfilter property
dataview view = new dataview(productsdatatable); checkedlistbox.datasource = view; checkedlistbox.displaymember = "name"; ... // hide discontinued products view.rowfilter = "discontinued = false";
Comments
Post a Comment