Canceling the selection in a ListBox

D

Dom

I selectively "disable" certain items in a ListBox. They appear gray
and italicized. I want to make sure the user never selects these. Is
there a way I can do this? For example, can I capture
"SelectedItemChanged" and simply cancel it so that there will no
subsequent call to DrawItem?

Dom
 
P

Peter Duniho

Dom said:
I selectively "disable" certain items in a ListBox. They appear gray
and italicized. I want to make sure the user never selects these. Is
there a way I can do this? For example, can I capture
"SelectedItemChanged" and simply cancel it so that there will no
subsequent call to DrawItem?

Please read the rest of my reply to your previous thread, the same one
in which I explained the technique you're using now to change the way
the text is drawn. It addresses this very question.

And no, you can't just cancel the "SelectedItemChanged" event. The
ListBox doesn't have that event, and the related events
"SelectedIndexChanged" or "SelectedValueChanged" are not a cancelable
events.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top