title: Combobox and System.Data.DataRowView
body: <p>I have a method that is called when the main form is opened</p>
  
  <pre><code>private void populateComboBoxes()
  {
      SqlCeDataAdapter breakfastAdapter = new SqlCeDataAdapter("SELECT DISTINCT recipeName FROM Recipe WHERE Category = 'breakfast' ", databaseConnection);
      SqlCeDataAdapter lunchAdapter = new SqlCeDataAdapter("SELECT DISTINCT recipeName FROM Recipe WHERE Category = 'lunch' ", databaseConnection);
      breakfastAdapter.Fill(breakfastDS, "Recipe");
      lunchAdapter.Fill(lunchDS, "Recipe");
      cmbBox1.DisplayMember = "recipeName";
      cmbBox1.ValueMember = "recipeName";
      cmbBox1.DataSource = breakfastDS.Tables["Recipe"];
      cmbBox2.DataSource = lunchDS.Tables["Recipe"];            
      cmbBox2.DisplayMember = "recipeName";
      cmbBox2.ValueMember = "recipeName";                      
  }
  </code></pre>
  
  <p>which essentially populates the two comboboxes based on the SELECT statements. Once this method hits <code>cmbBox1.DataSource = breakfastDS.Tables["Recipe"]</code> it stops executing and moves to this method:</p>
  
  <pre><code>private void cmbBox1_SelectedIndexChanged(object sender, EventArgs e)
  {         
      rtbPicture.Visible = false;
      string qry = "";
      qry = "SELECT DISTINCT ingredientName FROM Recipe WHERE recipeName = " + cmbBox1.SelectedItem.ToString();
  
      SqlCeCommand com = new SqlCeCommand(qry, databaseConnection);
      com.CommandText = qry;
      rtbRecipe.Text = com.ExecuteScalar().ToString();
  }
  </code></pre>
  
  <p>This method is supposed to execute the select statement and put that information in the <code>richtextbox</code>, but for some reason <code>cmbBox1</code> isn't set. From my understanding the first <code>combobox</code> already had set the display and value members in the previous method. However, when I get to the <code>cmbBox1.SelectedItem.ToString()</code> it returns <code>System.Data.DataRowView</code> instead of the actual string in the <code>combobox</code>. I'm not sure why it's giving me <code>System.Data.DataRowView</code> instead of the string. </p>