Hi all, I have a combobox which I populate with values from a table when
the form loads. After the combobox has loaded, if I set the Text
property, it shows in the text part of the combobox and if I drop down
the list, I see the correct value is highlighted as well, but if I check
ListIndex in code, it's still a (-1) as if nothing was selected. Am I
missing something? I can't set ListIndex myself because I don't know
the index, all I have is the string. Thanks.

RE: combobox Text property question by Bala

Bala
Thu Jun 17 17:05:01 CDT 2004

Hi,

make the combo box style property as 2. you will get the listindex.

one of my Colleague find this.

thanks
bala

"Dale" wrote:

> Hi all, I have a combobox which I populate with values from a table when
> the form loads. After the combobox has loaded, if I set the Text
> property, it shows in the text part of the combobox and if I drop down
> the list, I see the correct value is highlighted as well, but if I check
> ListIndex in code, it's still a (-1) as if nothing was selected. Am I
> missing something? I can't set ListIndex myself because I don't know
> the index, all I have is the string. Thanks.
>

Re: combobox Text property question by Ken

Ken
Thu Jun 17 17:16:56 CDT 2004

Dale wrote:
> Hi all, I have a combobox which I populate with values from a table when
> the form loads. After the combobox has loaded, if I set the Text
> property, it shows in the text part of the combobox and if I drop down
> the list, I see the correct value is highlighted as well, but if I check
> ListIndex in code, it's still a (-1) as if nothing was selected. Am I
> missing something? I can't set ListIndex myself because I don't know
> the index, all I have is the string. Thanks.

This should help... shows an API search method as well as a non-API method.

Subject: Re: Pre-Selecting Items in a Combo Box
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=ebfnKsRUDHA.2196%40TK2MSFTNGP12.phx.gbl

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..

Re: combobox Text property question by Dale

Dale
Thu Jun 17 17:51:00 CDT 2004

Thanks for the responses guys.

Ken, I was going to end up doing something the non-API method to get
around my problem ... but with your link I just cut 'n pasted and
modified a couple of identifiers. Thanks again.

> Dale wrote:
>
>> Hi all, I have a combobox which I populate with values from a table
>> when the form loads. After the combobox has loaded, if I set the
>> Text property, it shows in the text part of the combobox and if I drop
>> down the list, I see the correct value is highlighted as well, but if
>> I check ListIndex in code, it's still a (-1) as if nothing was
>> selected. Am I missing something? I can't set ListIndex myself
>> because I don't know the index, all I have is the string. Thanks.
>
>
> This should help... shows an API search method as well as a non-API method.
>
> Subject: Re: Pre-Selecting Items in a Combo Box
> http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=ebfnKsRUDHA.2196%40TK2MSFTNGP12.phx.gbl
>
>