Click here to Skip to main content
15,914,160 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to add new item 'select' to combo box on top selected, which has binded as uisng the following code.


C#
private void BindCombo()

      {

           DataTable dataTable = GetDataTable();


           comboBox1.DisplayMember = "Name";

           comboBox1.ValueMember = "Code";


           comboBox1.DataSource = dataTable;





       }
Posted
Updated 5-May-12 7:37am
v3

1 solution

C#
private void BindCombo()

        {

            DataTable dataTable = GetDataTable();

            DataRow row = dataTable.NewRow();

            row["Code"] = "None";

            row["Name"] = "None";

            dataTable.Rows.InsertAt(row, 0);

            comboBox1.DisplayMember = "Name";

            comboBox1.ValueMember = "Code";

           

            comboBox1.DataSource = dataTable;

          

 

        }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900