title: How to create LookUp fields in DataGridView?
body: <p>In my <code>DataGridView</code> I'am displaying a buch of columns from one table. In this table I have a column which points to item in another table. As you may already guessed, I want to display in the grid in one column some text value from the second table instead of and ItemID.
  I could not find a right example on the net how to do this.</p>
  
  <p>Lets assume that I have two tables in databes:</p>
  
  <p>Table Users:</p>
  
  <pre><code>UserID UserName UserWorkplaceID
    1     Martin        1
    2     John          1
    3     Susannah      2
    4     Jack          3
  </code></pre>
  
  <p>Table Workplaces:</p>
  
  <pre><code>WorkplaceID WorkplaceName
       1        "Factory"
       2        "Grocery"
       3        "Airport"
  </code></pre>
  
  <p>I have one untyped dataset <code>dsUsers</code>, one binding source <code>bsUsers</code>, and two <code>DataAdapters</code> for filling dataset (<code>daUsers</code>, <code>daWorkplaces</code>).</p>
  
  <p>Code which I am performing:</p>
  
  <pre><code>daUsers.Fill(dsUsers);
  daWorkplaces.Fill(dsUsers);
  bsUsers.DataSource = dsUsers.Tables[0];
  dgvUsers.DataSource = bsUsers;
  </code></pre>
  
  <p>At this point I see in my <code>dgvUsers</code> three columns, UserID, UserName and UserWorkplaceID. However, instead of UserWorkplaceID and values 1,2,3 I would like to see "Factory", "Grocery" and so on...</p>
  
  <p>So I've added another column to <code>dgvUsers</code> called "WorkplaceName" and in my code I am trying to bind it to the newly created relation:</p>
  
  <pre><code>dsUsers.Relations.Add("UsersWorkplaces", dsUsers.Tables[1].Columns["WorkplaceID"], dsUsers.Tables[0].Columns["UserWorkplaceID"]);
  
  WorkplaceName.DataPropertyName = "UsersWorkplaces.WorkplaceName";
  </code></pre>
  
  <p>Unfortunately that doesn't work. Relation is created without errors but fields in this column are empty after running the program.</p>
  
  <p>What I am doing wrong?</p>
  
  <p>I would like to also ask about an example with LookUp combobox in DataGridView which allow me to change the UserWorkplaceID but instead of numeric value it will show a tex value which is under WorkplaceName.</p>
  
  <p>Thanks for your time.</p>