Populate form based on combo box selection

JoshDecker

New member
Joined
Nov 30, 2010
Messages
1
Programming Experience
Beginner
I am very new to using visual studio and creating windows forms.

I have a table in a sql database called IndCustXRef

It has columns Cust; CustName; SlsCustID; SlsCustName; RprtCustID; RprtCustName; Shptrms

Cust is the Primary Key

I have created a form in visual studio.

Cust; SlsCustID; RprtCustID; and ShpTrms are Combo Boxes.
CustName; SlsCustName; RprtCustName are Text Boxes

All Three Combo boxes need have every custID as an option. I know how to do this, have bound each of them, and use the following code when the form loads

Me.IndCustIDXRefTableAdapter.Fill(Me.GartnerDataSet.IndCustIDXRef)
Me.CustCmb.Text = ""
Me.SlsCustCmb.Text = ""
Me.RprtCustCmb.Text = ""

This works fine and in testing and all combo boxes start empty but have every customer ID as an option

What I want to do is have the user select a customer ID from the Cust Combo box and have that selection populate the rest of the form. meaning fill the text boxes with the appropriate info for the Cust Combo Box (Primary key) , and selecting the value in the other combo boxes based on the Cust combo box.

I have created a paramatized query, and on leaving CustCmb i run the code

Me.IndCustIDXRefTableAdapter.FillBy(Me.GartnerDataSet.IndCustIDXRef, CustCmb.SelectedValue)

The problem Is I dont know how make The other boxes show the data that results from this query. I can make the other combo boxes display only the option based on this query but don't know how to make it just select the value based on the query. I also can not figure out how to populate the text boxes with data based on the query. Any help anyone could give on this would be great, and if I am leaving info out that would be needed to help me please let me know. Thanks in advance.
 
Back
Top