title: How can I convert an object from a combobox selected item to a string
body: <p>This is all in a WINDOWS FORM C#, MICROSOFT VISUAL STUDIO 2008</p>
  
  <p>I have a combo box that is being displayed this way:</p>
  
  <pre><code>private void populateCombos()
      {
          string GetConn1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = c:\\Data\\Db\\Comp.mdb";
          string queryString = "SELECT DISTINCT DC FROM Comp";
          OleDbDataAdapter dA = new OleDbDataAdapter(queryString, GetConn1);
          DataTable dC = new DataTable();
          dA.Fill(dC);
          comboBoxDC.DataSource = dC;
          comboBoxDC.DisplayMember = "DC";
  
          string GetConn2 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = c:\\Data\\Db\\Comp.mdb";
          string queryString2 = "SELECT DISTINCT PL FROM Comp";
          OleDbDataAdapter dA2 = new OleDbDataAdapter(queryString2, GetConn2);
          DataTable pL = new DataTable();
          dA2.Fill(pL);
          comboBoxPL.DataSource = pL;
          comboBoxPL.DisplayMember = "PL";
      }
  </code></pre>
  
  <p>I am having issues here being that I cannot make the selected item into a string:</p>
  
  <pre><code>        object da = comboBoxDC.SelectedItem;
          object pr = comboBoxPL.SelectedItem;
          Console.WriteLine(da.ToString());
  
          Console.WriteLine(da);
          Console.WriteLine(pr);
          //Connection...
  
          var list = new List&lt;dataQuery&gt;();
          string GetConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = c:\\Data\\Db\\Comp.mdb";
          string connectionString = GetConnectionString;
          string queryString = "SELECT DC, PL, CompID, User, Email FROM Comp WHERE DC = \'" + da + "\' AND PL = \'" + pr + "\'";
  </code></pre>
  
  <p>And in order for me to query these commands I need the selected item comboBoxDC to be a string and same for comboBoxPL.</p>
  
  <p>ANSWER!!!!!!!:</p>
  
  <p>So I found this out:</p>
  
  <p>code:</p>
  
  <pre><code>string da = comboBoxDC.Text.ToString();
  
  string pr = comboBoxPL.Text.ToString();
  
  Console.WriteLine(da)
  
  Console.WriteLine(pr)
  </code></pre>
  
  <p>output is successful with text.tostring and is actually string.</p>