Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select combobox item using a value 1

Status
Not open for further replies.

Paco75

Programmer
Oct 11, 2001
239
US
Hi,

I got a combobox filled with combobox.additem('values')
RowSourceType = 0 (none)

On init i want to place back the value the user had selected before he left the form. When the form is closed the value is stored in a public variable.

on init i do :
Code:
thisform.mycombobox.value = storedValue

but the combo box stay on first row (witch is blank)... how can i select the proper combobox item using a value?

thanks
 
If the comboboy bindto isn't .T., and noBoundColumn is specified, the setting of a value will not select that item from the list.

In this case I'd set the listindex to the listcount at the moment you add the value, that is equal to the storedValue. Untested, but that should do it.

Bye, Olaf.
 
One possibility is to set the combo's ControlSource to the variable in the Property Sheet.

That said, I suggest strongly that you don't use public variables. They're accidents waiting to happen. If you have some value that you need to make available throughout your application, set up an application object and add a property to it to store that value. The application object does need to be available through the application; you can store it in a private variable that you create in the main program. Mine is always called goApp.

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top