Avatar of Olukayode Oluwole
Olukayode Oluwole
Flag 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


How do i modify the script that worked  with a generic list
to now work with a Binding List
C#* list generate

Avatar of undefined
Last Comment
Olukayode Oluwole

8/22/2022 - Mon