Gmac
Gmac

Reputation: 169

Change data according to selected item in combobox

I call into a function which runs a query into SQLServer and returns a DataTable with multiple columns. I want the data from the DataTable to change rows according to the selected item in the combobox.

Dim dt As New DataTable
Dim rInt As New Int32

dt = subGetDB()
rInt = ComboBox1.SelectedIndex
Textbox1.Text = dt.Rows(rInt)("description").ToString()
TextBox2.Text = dt.Rows(rInt)("accountFilter").ToString()

Am I on the right track with this so far?

Upvotes: 0

Views: 115

Answers (1)

Marc Johnston
Marc Johnston

Reputation: 1286

Yes ... but you need to put all of the code above into the SelectedValueChanged event for the ComboBox1 object.

Upvotes: 1

Related Questions