Problem solve Get help with specific problems with your technologies, process and projects.

How do I link combobox items so corresponding items display when an item is selected?

How do I link combobox items with listbox items in such a way that, when a combobox item is selected, it cause corresponding item in list box to be displayed?
It's all a matter of handling the SelectedIndexChanged notification from the combo box. The following code shows how to do what you want:
Private Sub Form1_Load(ByVal sender As System.Object, _
                       ByVal e As System.EventArgs) Handles MyBase.Load
    ComboBox1.SelectedIndex = 0
End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, _
                                         ByVal e As System.EventArgs) _
                                 Handles ComboBox1.SelectedIndexChanged
    ListBox1.SelectedIndex = ComboBox1.SelectedIndex
End Sub

This was last published in October 2003

Dig Deeper on Win Development Resources

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.