Link to home
Create AccountLog in
Avatar of Olukayode Oluwole
Olukayode OluwoleFlag for Canada

asked on

How do i modify a script working and a Generic List to now work with a BindingList

I have in my c# application a script that worked fine
when i generated my List as a generic List.

Now I have changed the list generation method to a Binding list.
The 2 Bindling List are now defined and works properly

 BindingList<ARCustomerModel> customers = new BindingList<ARCustomerModel>();
 BindingList<ARSalesModel> salesinvoices = new BindingList<ARSalesModel>();

My Script Generating the error is shown below

[code]private void customerNameListBox_SelectedIndexChanged(object sender, EventArgs e)
            LoginDetails.staticentcode = "Quotation";
            ReferenceListProccesor processor4 = new ReferenceListProccesor();
            var newList4 = processor4.CustomerInvoices(LoginDetails.staticcompany, LoginDetails.staticentcode, "public.sparsales_getmasterrec");
            customerInvoicesListBox.DataSource = null;
            customerInvoicesListBox.DataSource = salesinvoices;
            customerInvoicesListBox.DisplayMember = "FullInvoicesList2";
            newList4.ForEach(x => salesinvoices.Add(x));
            var data = (sender as ListBox).SelectedValue as ARCustomerModel;
                if (data != null)
                    customerInvoicesListBox.DataSource = salesinvoices.Where(salesinvoices => data.ARCUSTCustomerID.Equals(salesinvoices.ARSALECustomerID)).ToList();
                    salesinvoices = salesinvoices.OrderBy(x => x.ARSALEExtDocumentNo).ToList();

And my error screen is shown below

User generated image
How do i modify the script that worked  with a generic list
to now work with a Binding List
Avatar of Kelvin McDaniel
Kelvin McDaniel
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Olukayode Oluwole


Got it.  Thanks