Hi Everyone,
I have a combobox that i want to update on a change event from a listbox. when an item is selected in a listbox it updates a combobox to show the details of the listbox’s selcted item. when i have the row tag stored in the listbox and i need to set the combobox’s index to match that row tag (all of the values in the combobox had a tag attached to them).
I hope this makes sense. Let me know any suggestions you may have!
The idea is really simple, you just iterate through every row on the Listbox
looking for the RowTag
you want and select the row if you find it.
Sample Code
for i as Integer = 0 to (ListBox.ListCount - 1)
if ListBox.RowTag(i) = "What I'm Looking For" then
ComboBox.ListIndex = i
exit
end
next
And of course, this falls apart if your ComboBox
doesn’t have the same number of rows. You should store a RowTag
in the ComboBox
that matches the RowTag
identifier in the Listbox
and use that to make selections.