title: Input string was not in a correct format
body: <p>Anyone Please help.... </p>
  
  <p>Error -</p>
  
  <blockquote>
    <p>Input string was not in a correct format.</p>
  </blockquote>
  
  <pre><code>int comboxchoice = Int32.Parse(comboBox1.SelectedValue.ToString());
  </code></pre>
  
  <p>i am using below code</p>
  
  <pre><code>private void Form2_Load(object sender, EventArgs e)
          {
              SqlConnection conn = new SqlConnection(@"Data Source=MANISH-PC\SQLEXPRESS;Initial Catalog=test2.mdf;Integrated Security=True");
              conn.Open();
              SqlCommand command = new SqlCommand("select * from table1", conn);
              SqlDataAdapter adp = new SqlDataAdapter(command);
              tbl = new DataTable();
              adp.Fill(tbl);
              comboBox1.DataSource = tbl;
              comboBox1.ValueMember = tbl.Columns[0].ColumnName;
              comboBox1.DisplayMember = tbl.Columns[0].ColumnName;
        }
          private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
          {
              SqlConnection conn = new SqlConnection(@"Data Source=MANISH-PC\SQLEXPRESS;Initial Catalog=test2.mdf;Integrated Security=True");
              conn.Open();
              SqlCommand command = new SqlCommand("select name from table1 where id=@id", conn);
              int comboxchoice = Int32.Parse(comboBox1.SelectedValue.ToString());
             command.Parameters.AddWithValue("@id",comboxchoice);
               SqlDataAdapter adp = new SqlDataAdapter(command);
              DataSet ds = new DataSet();
              adp.Fill(ds, "table1");
              textBox1.Text = ds.Tables["table1"].Rows[0]["name"].ToString();
             }
      }
  </code></pre>