} // ClearOrderScreen_Button_Click public void LoadManagerAccountList() { try { int ordercount = 0; // the number of orders to display List <string>[] ManagerAccountdata; // 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.ManagerAccountsData(out ManagerAccountdata); // Clear any existing data in the list box AssistantManagers_Listbox.DataSource = null; AssistantManagers_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(ManagerAccountdata[1][index] + " " + ManagerAccountdata[2][index] + " - " + ManagerAccountdata[3][index], ManagerAccountdata[0][index])); } // Insert Array List into the List Box AssistantManagers_Listbox.DataSource = ListBoxInfo; // Define which information is actually displayed by the listbox and returned AssistantManagers_Listbox.DisplayMember = "displayText"; AssistantManagers_Listbox.ValueMember = "databaseID"; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error loading Orders List", MessageBoxButtons.OK, MessageBoxIcon.Error); } } //LoadManagerAccountList