Results 1 to 2 of 2

Thread: Enable individual ComboBox items

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2004
    Location
    Stuttgart, Germany
    Posts
    29

    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

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    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
  •  



Click Here to Expand Forum to Full Width