次の方法でバインディング ソースに行を追加することは可能ですか。
"Please Select..." <-- what it will display on the combobox
DbNull.Value <-- Value
バインディング ソースにバインドされたデータであるコンボ ボックスがあります。データベースに余分な行を追加したくありません。コンボボックスに表示するだけのオプションがあるため、上記を読み取ると、対応する値がデータベースに設定されます。また、同じデータ メンバーとデータ ソースを使用する他のコンボ ボックスがあるため、その特定のコンボ ボックスにオプションを追加したいだけです。
上記は、デザイナー ファイルの InitializeComponent() メソッドの内容です。
this.cmbSecCSR = new System.Windows.Forms.ComboBox();
this.csrBindingSource2 = new System.Windows.Forms.BindingSource(this.components);
this.cmbSecCSR.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.cmbSecCSR.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
// this.cmbSecCSR.Items.Insert(0, "Select");
this.cmbSecCSR.DataSource = this.csrBindingSource2;
this.cmbSecCSR.DisplayMember = "Name";
this.cmbSecCSR.FormattingEnabled = true;
this.cmbSecCSR.Location = new System.Drawing.Point(112, 26);
this.cmbSecCSR.Margin = new System.Windows.Forms.Padding(0);
this.cmbSecCSR.Name = "cmbSecCSR";
this.cmbSecCSR.Size = new System.Drawing.Size(184, 21);
this.cmbSecCSR.TabIndex = 2;
this.cmbSecCSR.ValueMember = "Username";
this.cmbSecCSR.TextChanged += new System.EventHandler(this.comboBox_TextChanged);
this.cmbSecCSR.Enter += new System.EventHandler(this.cmbBox_Entered);
// csrBindingSource2
//
this.csrBindingSource2.DataMember = "CSR";
this.csrBindingSource2.DataSource = this.productionDS;
///