2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by thehunk
1

hello !
try this code , hope this will solve your prob.

Sub values()
        Dim con As New SqlConnection("connectionstring")
        con.Open()
        Dim da As New SqlDataAdapter("select name , idno from students", con)
        Dim dt As New DataTable
        da.Fill(dt)
        ComboBox1.DataSource = dt
        ComboBox1.DisplayMember = "name"
        ComboBox1.ValueMember = "idno"
    End Sub
'-----------------
'use this code at the selectedindex change event of your combobox
'-----------------
  TextBox1.Text = ComboBox1.SelectedValue.ToString()

Regards

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.