How do I get a textbox to automatically update with information when I select an item from a combobox? txtCustID.Text = Custds.Tables(0).Rows(cboCustomer.SelectedIndex).Item("custno") is what I came up with, and it populates properly when the combobox is first loaded up, but if I select another item, the text boxes don't change. Can anybody show me what I'm doing wrong?

Recommended Answers

All 2 Replies

Trap SelectedIndexChanged event of the combo box

Private Sub cboCustomer_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboCustomer.SelectedIndexChanged

  txtCustID.Text = Custds.Tables(0).Rows(cboCustomer.SelectedIndex).Item("custno")

End Sub
commented: Simple and easily understood post - with example! +3

Worked like a charm. Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.