디자인 클래스 : 엔티티에 바인딩 된 콤보 박스에 새 항목을 추가하는 방법은 무엇입니까? C 번호로 생성
//
// usepurposeComboBox
//
this.usepurposeComboBox.DataSource = this.usepurposeBindingSource;
this.usepurposeComboBox.DisplayMember = "Name";
this.usepurposeComboBox.FormattingEnabled = true;
this.usepurposeComboBox.Location = new System.Drawing.Point(277, 53);
this.usepurposeComboBox.Name = "usepurposeComboBox";
this.usepurposeComboBox.Size = new System.Drawing.Size(218, 21);
this.usepurposeComboBox.TabIndex = 4;
this.usepurposeComboBox.ValueMember = "id";
//
// usepurposeBindingSource
//
this.usepurposeBindingSource.DataSource = typeof(mydatabaseEntities.usepurpose);
그럼 내가 엔티티에 BindingSource에 (usepurposeBindingSource)를 구속은 : 바인드되어 있기 때문에
usepurposeBindingSource.DataSource = mydatabaseEntities.usepurposes;
그리고 usepurposeComboBox에 새 행을 추가 할 수 없습니다. 해결 방법이 있습니까?
그것은 할 수 없습니다. System.Windows.Forms.dll에서 'System.ArgumentException'형식의 처리되지 않은 예외가 발생했습니다. 추가 정보 : DataSource 속성을 설정하면 Items 컬렉션을 수정할 수 없습니다. – JatSing
왜 'this.usepurposeBindingSource'에 추가하지 않습니까? – balexandre