I trying to populate a Windows Form Listbox from data stored in an ArrayList. The array list consists of a struct in which the data comes from MSSQL.
I am able to get the data from MSSQL.
I am able to populate the Struct and put the data in the ArrayList.
My problem is getting the data from the ArrayList and into the Listbox.
My Struct us called udtCustomers and has the following members:
My Arraylist is called alCustomerItemsDB
My ListBox is called lboxCustomers
After filling the arraylist from MSSQL I try to populate the Listbox using the PopulateCustomerLookup method below:
NOTE: I would like to store the PrimaryKey in the ValueMember property and the CustomerName in the DisplayMember property of the Listbox.
private void PopulateCustomerLookup()
// Shutdown the painting of the ListBox as items are added.
// loop through each radio button in the alProductButtons array list.
foreach(udtCustomers udtCust in this.alCustomerItemsDB)
// Allow the ListBox to repaint and display the new items.