I am trying to bind a datasource with LookupEdit at runtime. I tried this code but getting an error . This results in the binding of two bindings in the collection to the same property. Parameter Name: Binding Help me solve this problem? This is my code.
OleDbDataAdapter testcustomers = new OleDbDataAdapter(
"SELECT CustomerId, Customername FROM Customer WHERE CompanyId =" + TXE_CompId.Text, connection);
DataSet ds = new DataSet();
testcustomers.Fill(ds, "Customer");
BindingSource binding_cust = new BindingSource(ds, "Customer");
CBL_SelectCustomer.DataBindings.Add("EditValue", binding_cust, "CustomerId");
CBL_SelectCustomer.Properties.DataSource = binding_cust;
CBL_SelectCustomer.Properties.DisplayMember = "CustomerName";
CBL_SelectCustomer.Properties.ValueMember = "CustomerId";
LookUpColumnInfoCollection coll = CBL_SelectCustomer.Properties.Columns;
coll.Add(new LookUpColumnInfo("CustomerName", 0));
Thanks in advance, Srihari
source
share