Hi im new to C# and I have a form with customer data on it. There is a combo box with the customer name and some address fields. When I select the customer name I would like the address field to be automatically updated from the customer table. Can anyone help me with the code for this. Thanks in advance.

thats normally why you bind the control to the table/query

This form is used to fill out another table for quoting. The customer table is used as reference to fill out the customer portion of the quote form.

As LizR said, binding is the best approach, however you can manually locate the Customer in the table and populate the address text box.

string custName = combobox.Text;
DataRow[] addressInfo = custData.Select(string.Format("Customer='{0}'",custName));
if(addressInfo.Length > 0)
{
    edStreet.Text = (string)addressInfo[0]["Street"];
    edCity.Text = (string)addressInfo[0]["City"];
    // and so on...
}

Hope this helps,
Jerry

This question has already been answered. Start a new discussion instead.