CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    25

    Hiding combo box items

    I have 2 different systems a user can choose from. The same screen appears no matter whether the user selects system 1 or 2. However, there is a drop down Item combo box that has 16 items, each numbered 1-16. However, 1-16 should only appear if system 2 is selected. If system 1 is selected, only items 1-5 should appear. I can use IsEnabled, but that doesn't collapse or hide the last 11 items. Is there a way to hide items 6-16 instead of making them just unselectable?

  2. #2
    Join Date
    Jan 2010
    Posts
    1,133

    Re: Hiding combo box items

    You can empty the combobox and then refill it with only those items required (or just remove/add the last 11 items via the Items property), when your "system" changes. Or you could use two different combo boxes, showing only one at a time (in the same location). If you use binding, you could also create two item collections, and rebind as necessary.

    It would help if you showed some code. And provided additional information.
    Is this Windows Forms? WPF? What?

  3. #3
    Join Date
    Mar 2004
    Posts
    25

    Re: Hiding combo box items

    Thanks for the options. I'm using WPF to define the combo box.

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

Featured