} //LoadManagerAccountList public void LoadManagerInventoryList() { try { int ordercount = 0; // the number of orders to display List <string>[] ManagerInventorydata; // the orders that will be displayed ArrayList ListBoxInfo = new ArrayList(); // Array List where formatted text will be stored. // connect to DB if it is not connected if (!nsadb.Connected()) { nsadb.OpenConnection(); } //request the Records to display on the manager orders list ordercount = nsadb.ManagerGetInventoryData(out ManagerInventorydata); // Clear any existing data in the list box Inventory_Listbox.DataSource = null; Inventory_Listbox.Items.Clear(); // If there is no data in the database skip attempting to load the List // It will cause an error. if (ordercount == 0) { return; } //loop over the records and format them in the Array List for (int index = 0; index < ordercount; index++) { ListBoxInfo.Add(new BoxFormat(ManagerInventorydata[1][index] + " - " + ManagerInventorydata[2][index], ManagerInventorydata[0][index])); } // Insert Array List into the List Box Inventory_Listbox.DataSource = ListBoxInfo; // Define which information is actually displayed by the listbox and returned Inventory_Listbox.DisplayMember = "displayText"; Inventory_Listbox.ValueMember = "databaseID"; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error loading Inventory List", MessageBoxButtons.OK, MessageBoxIcon.Error); } } //LoadManagerInventoryList