ComboBox - Changing the selected item

  • Thread starter Thread starter Michael Turner
  • Start date Start date
M

Michael Turner

Hi I am having a problem with a combobox the values are generated from a
recordset, I need to beable to change the selected item to the value
specified in a configuration file, I have stored the value as a varible. I
am using the code below but it isn't working any ideas am I using the right
method.


combobox1.selecteditem = getcolvalue(0)

Any help appreciated.

Mike.
 
Hi,
Does the value returned by getcolvalue(0) exist in the combobox list? If it
doesn't, then you will not see the selected item changing.


Hi I am having a problem with a combobox the values are generated from a
recordset, I need to beable to change the selected item to the value
specified in a configuration file, I have stored the value as a varible. I
am using the code below but it isn't working any ideas am I using the right
method.


combobox1.selecteditem = getcolvalue(0)

Any help appreciated.

Mike.
 
Hi

Yest it does the value was created by the listbox and saved to the config.

Mike.
 
Hi,
Just to try an alternative way, have the following instead of using
SelectedText:

combobox1.SelectedIndex = combobox1.FindStringExact(getcolvalue(0))

If the return value of "combobox1.FindStringExact(getcolvalue(0))" is -1
then getcolvalue(0) is returning something that doesn't exist in the combo
list.

Hi

Yest it does the value was created by the listbox and saved to the config.

Mike.
 
Hi Shiva

Yes that worked, after a bit of playing about I think the first method was
not working because of the way I was pulling the information from the
database, the selectitem method was not returning a string value(well thats
what it said when I tried writing the selecteditem to the debug window)!.

Thanks for all your help.

Mike.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top