【发布时间】:2016-01-13 13:09:33
【问题描述】:
我正在尝试将默认值添加到已填充数据源的组合框中。查看下图:
值是从 oracle 数据库自动添加的。现在我需要再添加一个代表所有类别的默认值。
这是一个设计器代码:
this.comboBox2.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.vRSTEPROBLEMABindingSource, "NAZIV", true));
this.comboBox2.DataSource = this.vRSTEPROBLEMABindingSource1;
this.comboBox2.DisplayMember = "NAZIV";
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Location = new System.Drawing.Point(89, 51);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(173, 21);
this.comboBox2.TabIndex = 4;
this.comboBox2.Text = "Svi";
this.comboBox2.ValueMember = "NAZIV";
【问题讨论】:
-
在将绑定源设置为数据源之前,您需要为其添加默认值。
标签: c# combobox datasource default