dynamically lengthened combobox

M

medicenpringles

this one is a bit complicated.

so i have a form with a combobox and two textboxes. the combobox is,
by default, filled with the string "Ingredient 1" in the first line.

what i would like to do with this is to have the user input text into
either or both of the two text boxes, and when the user clicks the
combobox again, another row in the combobox, "Ingredient 2" is added so
that the user can input text into the textboxes for that ingredient.

the trick is, i would like to make it so that when the user returns to
ingredient 1 or 2 or so on, the text they entered for those ingredients
is filled back into the text box.

my only problem is i can't seem to find the method/properties that
allow changes on the selection of an item in a combobox. the rest i
think i can do.

any help is appreciated,
sven.
 
N

Nigel

The items in a combobox can be read using the listindex which starts at 0 to
n-1 for each item n in the list. A value of -1 is returned if there is no
selection. You can use this value to index your sheet list. Use the change
event for the combobox to determine the listindex value e.g......

Private Sub ComboBox1_Change()
If combobox_1.ListIndex > -1 Then
' run your code to update the textboxes based on the valid listindex
End If
End Sub

--
Cheers
Nigel



"medicenpringles"
 

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

Top