469,963 Members | 1,738 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

C#:APPS - Grey out and disable some of the elements in combo box

6
Hi Guys and Girls,

I am building a windows application using VS2005, C#.net. Now, I have a combo box that contains a collection of elements.

Thus, I want to grey out some of the elements in the combo box. Alas, I cannot find any properties or forum that able to help me to grey out and disable some of the elements in combo box.

Does anyone have any idea on how to grey out and disable the combo box's elements. Your help is really appreciated.

Thank you and have a nice day.
Feb 20 '08 #1
2 3902
nateraaaa
663 Expert 512MB
Hi Guys and Girls,

I am building a windows application using VS2005, C#.net. Now, I have a combo box that contains a collection of elements.

Thus, I want to grey out some of the elements in the combo box. Alas, I cannot find any properties or forum that able to help me to grey out and disable some of the elements in combo box.

Does anyone have any idea on how to grey out and disable the combo box's elements. Your help is really appreciated.

Thank you and have a nice day.
Why grey them out? Just populate the combo box with the items that will be available to the user.

Nathan
Feb 20 '08 #2
Plater
7,872 Expert 4TB
Why grey them out? Just populate the combo box with the items that will be available to the user.

Nathan
Yeah, I would recomend that.
I'm not even sure it's POSSIBLE to "disable" some entries in a combo box. I've never seen it done.

ALTHOUGH, if you put an event handler on the selectedindex change event, you could maybe mimic the behaviour.
In it you would:
Check to see if the new index refers to a valid (read: not disabled) entry. If it's valid, update a state variable with the good index and exit the function.
If it's an INVALID index (disabled entry), change the index to the last "good" index saved in the state variable.
Feb 20 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by J Belly | last post: by
3 posts views Thread by MervinJadhav | last post: by
5 posts views Thread by acord | last post: by
4 posts views Thread by Patrick Flaherty | last post: by
reply views Thread by dudeja.rajat | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.