Bineesh  Viswanath

Bineesh Viswanath

  • NA
  • 1k
  • 775.4k

Add new Row into comboBox in Windows Form

Oct 5 2013 6:54 AM
Sir, I need your help in solving a doubt in Windows Form Application.

Please go through the code below. Data is being rendering from database.

I want to insert "-Select-" to the Zero index of the comboBox.

How can it possible?

try
{
if(sqlCon.State==ConnectionState.Closed)
{
sqlCon.Open()
}
DataTable dtbl=new DataTable();
SqlDataAdapter Sqlda=new SqlDataAdapter("StudentViewAll", sqlCon);
da.Fill(d);
combBox1.DataSource = dtbl;
comboBox1.DisplayMember="Name";
comboBox1.ValueMember="id;
}
catch(Exception)
{
throw;
}

Answers (1)