By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,238 Members | 1,746 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,238 IT Pros & Developers. It's quick & easy.

Canceling the selection in a ListBox

P: n/a
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

Jul 29 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Dom wrote:
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
Jul 29 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.