VB.Net Clicking on an item in combobox and the related info is displayed in another form
Posted on 2005-05-06
I have a ComboBox on a form in VB.net...I have the comboBox being populated from a field in a table in the database.
What I am trying to do is I click on an item from the drop-down list and I want a form to pop-up with the info related to the item clicked on from the box.
Right now I have this code on the loading of the form that holds the combo box...
Dim dsn As String = "User ID=sa;password=ma;Initial Catalog=sa;Data Source=CYCLE"
Dim myConn As SqlClient.SqlConnection = New SqlClient.SqlConnection(dsn)
Dim myComm As SqlDataAdapter = New SqlDataAdapter("Select distinct order_number from rec_orders", myConn)
Dim ds As DataSet = New DataSet
Dim dv As DataView = ds.Tables("Rec_Orders").DefaultView
ComboBox1.DataSource = dv
ComboBox1.DisplayMember = "order_number"
So if I click on the order number from the combo box...I want that to return all the related info from another table ( tbl_Order) for that order_number on another form that pops - up..(.I am thinking that I will need to pass in the ID for that order number) .
The info of the form that pops - up needs to be just displayed not edited.
I am a bit in the dark on how to exactly do this codewise...any insight or help would be much appreciated.