title: How to delete row from database depending on what is selected within a combobox
body: <pre><code> private void DeleteClient_Load(object sender, EventArgs e)
      {
          try
          {
              connection = new SqlConnection(new DatabaseConnection().cnnString.ToString());
              connection.Open();
          }
          catch (Exception exp)
          {
              MessageBox.Show(exp.Message, "Could not establish connection to the database.", MessageBoxButtons.OK, MessageBoxIcon.Error);
          }
  
          cmd = new SqlCommand(new DatabaseAdd().addToComboBoxSE.ToString(), connection);
  
          cmd.ExecuteNonQuery();
          DataTable dt = new DataTable();
          SqlDataAdapter da = new SqlDataAdapter(cmd);
          da.Fill(dt);
          foreach(DataRow dr in dt.Rows)
          {
              comboBox1.Items.Add(dr["Id"] + ". " + dr["FirstName"] + " " + dr["Surname"]);
          }
          connection.Close();
  
      }
  </code></pre>
  
  <p>Here i am adding items to a comboBox from a database. I am adding the ID(int), FirstName(varchar) and Surname(varchar) to each item for each row in the database. </p>
  
  <p>My question is, how do i go about deleting a row from the database depending on a list item i have selected within the comboBox? I am able to do it when i just add the ID(int) to the comboBox but since i need the id, firstname and surname, i am unable to retrieve the ID from whatever list option i have selected.</p>
  
  <p>Any help is appreciated. Thank you.</p>