combo box first displayed item
Posted on 2004-04-13
I'd like to know how can I set a particular string as the default item into a combo box (VB 6).
I use a combo box with Style property = 2 (i.e. a dropdown list) to display an ORDERED list of string coming from a db field.
During a search process, the user should choose one of them but he could not choose it at all (because it's not a necessary clause in the criteria), so I manually added to the list the word 'ANY'.
Well, since the combo list is ordered ANY does not appear at the first index and the first cell of the combo is always blank.
So, 2 questions:
I need to have an ordered combo where the first voice is always ANY and ANY must be visible as first element also without any selection on the combo.
Is it possible and how ? (I cannot do this through setting Text property since it's read only)
If I need to know the index number of a given element (string), which function returns it ?
Thanks for any kind of help.