/// <summary>
        /// Populate the listbox with the list that is passed in.
        /// </summary>
        /// <param name="allElectronics">The list used to populate the listbox</param>
        private void populateList(List <Electronic> allElectronics)
        {
            productLstBox.Items.Clear();

            foreach (String cat in ElectronicDb.GetAllCategories())
            {
                productLstBox.Items.Add(Validation.casingWords(cat));

                foreach (Electronic elect in allElectronics)
                {
                    if (elect.Category == cat)
                    {
                        productLstBox.Items.Add(elect);
                    }
                }
            }
        }
예제 #2
0
        private void addElectFrm_Load(object sender, EventArgs e)
        {
            List <String> allCategories = ElectronicDb.GetAllCategories();

            populateList(allCategories, categoryCbx);
        }