Link to home
Start Free TrialLog 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";
            salesinvoices.Clear();                  
            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();
               
                }
        }[/code]

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
ASKER CERTIFIED SOLUTION
Avatar of Kelvin McDaniel
Kelvin McDaniel
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Olukayode Oluwole

ASKER

Got it.  Thanks