} //LoadManagerComponentList public void LoadManagerMenuItemList() { try { int itemcount = 0; // the number of menu items returned by database int componentcount = 0; // The number of components returned by database int categorycount = 0; // The number of component category returned List <string>[] ManagerMenuItemdata; // The Menu Items that will be displayed List <string>[] ManagerComponentdata; // The Components that will be displayed List <string>[] ManagerItemCategory; // The Categories that will be displayed ArrayList ListBoxInfo = new ArrayList(); // Array List where formatted text will be stored. ArrayList CheckBoxInfo = new ArrayList(); // Array List where formatted text will be stored. ArrayList CategoryInfo = 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 itemcount = nsadb.ManagerGetMenuItemData(out ManagerMenuItemdata); componentcount = nsadb.ManagerGetComponentData(out ManagerComponentdata); categorycount = nsadb.ManagerGetMenuItemCategory(out ManagerItemCategory); // Clear any existing data in the list box MenuItems_Listbox.DataSource = null; MenuItems_Listbox.Items.Clear(); MenuItemsComponent_CheckedListbox.DataSource = null; MenuItemsComponent_CheckedListbox.Items.Clear(); MenuItemCategory_comboBox.DataSource = null; MenuItemCategory_comboBox.Items.Clear(); // If there is no data in the database skip attempting to load the List // It will cause an error. if (itemcount == 0) { return; } //loop over the records and format them in the Array List for (int index = 0; index < itemcount; index++) { ListBoxInfo.Add(new BoxFormat(ManagerMenuItemdata[1][index], ManagerMenuItemdata[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(ManagerItemCategory[1][index], ManagerItemCategory[0][index])); } if (componentcount == 0) { return; } for (int index = 0; index < componentcount; index++) { CheckBoxInfo.Add(new BoxFormat(ManagerComponentdata[1][index], ManagerComponentdata[0][index])); } // Insert Array List into the List Box MenuItems_Listbox.DataSource = ListBoxInfo; MenuItemsComponent_CheckedListbox.DataSource = CheckBoxInfo; MenuItemCategory_comboBox.DataSource = CategoryInfo; // Define which information is actually displayed by the listbox and returned MenuItems_Listbox.DisplayMember = "displayText"; MenuItems_Listbox.ValueMember = "databaseID"; MenuItemsComponent_CheckedListbox.DisplayMember = "displayText"; MenuItemsComponent_CheckedListbox.ValueMember = "databaseID"; MenuItemCategory_comboBox.DisplayMember = "displayText"; MenuItemCategory_comboBox.ValueMember = "databaseID"; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error loading Component List", MessageBoxButtons.OK, MessageBoxIcon.Error); } } //LoadManagerMenuItemList