Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable items in listbox if user selects a particular list item

Status
Not open for further replies.

NewToProgramming

Technical User
Jun 24, 2003
31
US
I have created a listbox with the multiselect property set to True. My listbox has 5 items. I want to create logic in my program so that if, for example, the user selects the first item on the list (ListIndex = 0), they are not able to select any other item on the list. If, instead of selecting the first item on the list, they selected the second item (ListIndex = 1) I want to make it so that if they pick the second item they can also select items 4 and 5, but not 1 or 3. And the program would continue on so that depending on what item(s) they click, it would automatically disable other items on the list that are not compatible, only allowing them to select the multiple list items that ARE compatible. Any help would be much appreciated. Thanks.
 
The interdependencies of these choices don't suggest a list box to me, especially since there are so few and they're apparently fixed. I'd suggest replacing it with a set of check boxes and/or option buttons, and using their AfterUpdate events to enable/disable the other controls. This is typical of how such things are done in many property sheets and wizards, for example. Rick Sprague
 
Thanks. I have switched to checkboxes and I have everything working exactly as I want it now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top