private void customerIDComboBox_SelectedIndexChanged(object sender, EventArgs e) { // get CustomerID from combo box string custID = customerIDComboBox.Text; var temp = from customer in customers where customer.CustomerID == custID select customer; foreach (var c in temp) { companyNameTextBox.Text = c.CompanyName; contactNameTextBox.Text = c.ContactName; contactTitleTextBox.Text = c.ContactTitle; addressTextBox.Text = c.Address; cityTextBox.Text = c.City; postalCodeTextBox.Text = c.PostalCode; countryTextBox.Text = c.Country; regionTextBox.Text = c.Region; phoneTextBox.Text = c.Phone; faxTextBox.Text = c.Fax; } // get the orders for that customer id and populate the orders table List <Order> orders = OrderDB.GetOrdersByID(custID); //var temp2 = from order in orders where order.CustomerID == custID select order; dataGridView1.DataSource = orders; }