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.
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.
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?
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.
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?
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.