Results 1 to 11 of 11

Thread: Highlight Item in ComboBox? [RESOLVED] !!!

  1. #1

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Resolved Highlight Item in ComboBox? [RESOLVED] !!!

    I know that I can use .Selected(0) in a listbox, but I need to do the same thing in a ComboBox. I set the .ListIndex and .TopIndex to 0, but the item isn't selected (highlighted). I want it to be visible on the screen.
    What am I overlooking? There is no .Selected property!
    Last edited by dglienna; Dec 13th, 2004 at 07:48 PM.

  2. #2

  3. #3

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Highlight Item in ComboBox?

    The style is 0, but if I make it 1, then selecting the index of 2 calls the third item into view, but it still isn't selected. If I click it, then it is highlighted. I want it highlighted before clicking on it.

    .ListIndex = 1 shows the second item, so I know that it is correct to use 0 for the value. there must be another way to actually HIGHLIGHT it.
    Last edited by dglienna; Dec 13th, 2004 at 06:38 PM.

  4. #4
    New Member
    Join Date
    Oct 2003
    Posts
    10

    Re: Highlight Item in ComboBox?

    So you want to select an item in a combobox from the code ?
    Like let's say you want to initialise your form and you need to select the 2nd item in the combobox before the user click on it?

    Or if it's something else, maybe you can paste your code and explain what you expect to see?

  5. #5

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Highlight Item in ComboBox?

    when I set the selected item (first item [0]), it appears, but is not highlighted. the default for a new project does highlight it. not sure what could have happened.

  6. #6

  7. #7

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Highlight Item in ComboBox?

    I want mine to work like the middle one, so the item is highlighted. my combo looks like the third one, which doesn't highlight the item when you click the button.

    hmmm, when I change mine to style 1, it still doesn't highlight the item.
    what could be wrong?

  8. #8
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Highlight Item in ComboBox?

    Is the hieight of the combobox extended like my middle one? If not then that's the problem because it has to be extended to work. If it is extended then put a breakpoint on this line cboStyle1.ListIndex = 1 (or the equivalent in your program) and step through the code because something is unselecting it.

  9. #9
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918

    Re: Highlight Item in ComboBox?

    If I understand your problem correctly, could you not just do this:
    Code:
        Combo1.ListIndex = whatever
        Combo1.SelStart = 0
        Combo1.SelLength = Len(Combo1.Text)
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  10. #10

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Highlight Item in ComboBox?

    it's not extended. i will try the other method.

  11. #11

    Thread Starter
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Highlight Item in ComboBox?

    Hey, that did it. Thanks, Pete.

    Now, to get the flicker problem with msgbox resolved.

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