Hi..
Oues : Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?
Which property on a Combo Box do you set with a column name
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


Satyapriya NayakRank #47 · 31.5K reputationPosted Jan 23, 2012, 6:29 AM EST
When we use Databind method for the Combobox we set DisplayMember to display data in the combo box.
Ex:-
str = "select * from student";
com = new SqlCommand(str, con);
sqlda = new SqlDataAdapter(com);
ds = new DataSet();
sqlda.Fill(ds, "student");
comboBox1.DataSource = ds.Tables["student"];
comboBox1.DisplayMember = "sid";
Thanks