本文介绍了无法绑定到新的显示成员。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在使用以下代码&得到错误。 无法绑定到新的显示成员。 其中我有2个radiobutton& 1个组合框和1个按钮 i m using following code & get the error."Cannot bind to the new display member."in which i m having 2 radiobutton & 1 combobox and 1 buttonprivate void btnshow_Click(object sender, EventArgs e){ panel1.Visible = false; if (rbparty.Checked == true) { panel1.Visible = true; fetchParty(); //comboBox1.DisplayMember = "Table.P_Namee"; //comboBox1.ValueMember = "P_Name"; MessageBox.Show(rbparty.Text); } if (rbProduct.Checked == true) { panel1.Visible = true; fetchProduct(); //comboBox1.DisplayMember = "Table.Prod_Name"; //comboBox1.ValueMember = "Prod_Name"; MessageBox.Show(rbProduct.Text); }} public void fetchProduct() { comboBox1.DisplayMember = ""; da = new SqlDataAdapter("Select Prod_Name from tblProdMaster", con); DataSet ds = new DataSet(); comboBox1.DataSource = ds; da.Fill(ds); comboBox1.DisplayMember = "Table.Prod_Name"; comboBox1.ValueMember = "Prod_Name"; } public void fetchParty() { comboBox1.DisplayMember = ""; da = new SqlDataAdapter("Select P_Name from tblPartyMaster", con); DataSet ds1 = new DataSet(); da.Fill(ds1); comboBox1.DataSource = ds1; comboBox1.DisplayMember = "Table.P_Namee"; comboBox1.ValueMember = "P_Name"; } 任何人都可以帮我。 感谢提前can anyone help me pls.?THANKS IN ADVANCE推荐答案 public void fetchProduct() { da = new SqlDataAdapter("Select Prod_Name from tblProdMaster", con); DataSet ds = new DataSet(); comboBox1.DataSource = ds; da.Fill(ds); comboBox1.DisplayMember = "Prod_Name"; comboBox1.ValueMember = "Prod_Name"; } public void fetchParty() { da = new SqlDataAdapter("Select P_Name from tblPartyMaster", con); DataSet ds1 = new DataSet(); da.Fill(ds1); comboBox1.DataSource = ds1; comboBox1.DisplayMember = "P_Name"; comboBox1.ValueMember = "P_Name"; } 这篇关于无法绑定到新的显示成员。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-20 02:55