how to dynamically add combobox in windows forms(C#) and bound it to a column of a table in sql database

前端 未结 3 1964
我寻月下人不归
我寻月下人不归 2021-01-07 14:48

My windows form has an ADD button which adds a combo box to the form after each click. The problem is, i am not able to bind it to a table column at run time. Using an exist

3条回答
  •  孤街浪徒
    2021-01-07 15:00

    Option 1: Fill the combobox with strings:

    this.comboBox1.Items.Add("Syed");
    this.comboBox1.Items.Add("Baqar");
    

    Option 2: Fill the combobox with an array of strings:

    this.comboBox1.Items.AddRange(new object[] { "Syed", "Baqar" });
    

提交回复
热议问题