} //LoadManagerInventoryList public void LoadManagerComponentList() { try { int ordercount = 0; // the number of orders to display int categorycount = 0; List <string>[] ManagerComponentdata; // the orders that will be displayed List <string>[] ManagerComponentCategory; // The component categories ArrayList ListBoxInfo = new ArrayList(); // Array List where formatted text will be stored. ArrayList CategoryInfo = new ArrayList(); // 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.ManagerGetComponentData(out ManagerComponentdata); categorycount = nsadb.ManagerGetComponentCategory(out ManagerComponentCategory); // Clear any existing data in the list box Components_Listbox.DataSource = null; Components_Listbox.Items.Clear(); ComponentCategory_comboBox.DataSource = null; ComponentCategory_comboBox.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(ManagerComponentdata[1][index] + " - $" + ManagerComponentdata[2][index], ManagerComponentdata[0][index])); } if (categorycount == 0) { return; } //loop over the records and format them in the Array List for (int index = 0; index < categorycount; index++) { CategoryInfo.Add(new BoxFormat(ManagerComponentCategory[1][index], ManagerComponentCategory[0][index])); } // Insert Array List into the List Box Components_Listbox.DataSource = ListBoxInfo; ComponentCategory_comboBox.DataSource = CategoryInfo; // Define which information is actually displayed by the listbox and returned Components_Listbox.DisplayMember = "displayText"; Components_Listbox.ValueMember = "databaseID"; ComponentCategory_comboBox.DisplayMember = "displayText"; ComponentCategory_comboBox.ValueMember = "databaseID"; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error loading Component List", MessageBoxButtons.OK, MessageBoxIcon.Error); } } //LoadManagerComponentList