Question Locked

combobox / datagridcomboboxcolumn disable or hide items

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a winform with some comboboxes and datagrids with
datagridcomboboxcolums. I am binding these comboboxes with data from
the database table. Over time some of the items can be inactivated
from the list. The problem is that forms that items that are
inactivated already selected when they were active.
How can I display items that are inactivated, but prevent user from
selecting those items.
Thank you

2 replies

by tony hopkinson

trying to use combobox for something it wasn't really designed for. The items in the list are by definition available.

Now you could overide the paint mechanism so you could show unavailable in say grey, you could overide the selection process to ignore the selection of an unavailable item.
You could write the code to deal with a once available selection becoming unavailable.

The question is, is this really wise ?

The fact that the control is also databound is going to maginify your problems as well. As soon as you want nonstandard behaviour the binding mechanism will get right in your face, from the get go.

This discussion is closed to new replies.