|
-
Dec 7th, 2004, 12:01 PM
#1
Thread Starter
Junior Member
Enable individual ComboBox items
Is there a way to define individual Enabled states for different items in a ComboBox?
Illustrative Example (not valid code):
Code:
ComboBox.Item.Add("Car")
ComboBox.Item.Add("Truck")
ComboBox.Item.Add("Bike")
ComboBox.Item(0).Enabled=True
ComboBox.Item(1).Enabled=False
ComboBox.Item(2).Enabled=True
Effect:
All three items are shown, but only items 0 and 2 can be selected
(No work-around like removing items that are not enabled. All items have to be shown!)
Thanks
-
Dec 7th, 2004, 12:31 PM
#2
Re: Enable individual ComboBox items
nope, it is simply not possible using a combobox...
only thing I could think of, would be to create your own custom combobox that uses a custom ObjectCollection in it (which is the type that the Items collection in a combobox is)
you would have to override paint events to draw the disabled items grayed or something of that nature to indicate their state....
but all this is probably more trouble than it is worth or there may be another option you want to explore..
I know you said "all items have to be shown" but the combobox just wasnt designed to be used in this way.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|