title: Binding a ComboBox using a DataContext and LINQ to SQL
body: <p>I have a simple SQLite database I use to track invoices.  I recently decided to write an application for it as an excuse to learn LINQ.  I found <a href="https://stackoverflow.com/questions/831345/linq-sql-data-binding-to-winforms-combobox">other questions</a> that address this issue, but none of the solutions worked for me.</p>
  
  <p>Using the O/RM designer, I modeled my database similar to the following (simplified):</p>
  
  <pre><code>+------------+           +----------+
  |  Invoice   |           | Customer |
  +------------+           +----------+
  | ID         |      +----| ID       |
  | CustomerID |&lt;-----+    | Name     |
  +------------+           +----------+
  </code></pre>
  
  <p>This works great for binding the invoices table to a list and seeing a list of customers, but I'm not quite getting how to bind the table of customers to a <code>ComboBox</code> while showing the <code>Customer</code> for the invoice.</p>
  
  <p>Here's the code that sets up the binding:</p>
  
  <pre><code>InvoiceList.DataSource = _db.Invoices;  // InvoiceList is ListBox
  CustomerBox.DataSource = _db.Customers;  // CustomerBox is ComboBox
  CustomerBox.DataBindings.Add("SelectedItem", InvoiceList.DataSource, "Customer");
  </code></pre>
  
  <p>In this case, <code>_db</code> is the <code>DataContext</code> generated by the O/RM.</p>
  
  <p>As I select different items in the invoice list, the customer box doesn't seem to show any changes I've made.  Any pointers how to correct this?  Is there a better way to setup this binding?</p>