1
Answer

Add new Row into comboBox in Windows Form

Bineesh  VP

Bineesh VP

11y
1.1k
1
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)