public AddCont(CategoriesManager categoriesManager) { InitializeComponent(); categoriesManager.LoadData(); comboBox1.Items.Clear(); foreach (var el in categoriesManager.Categories) { comboBox1.Items.Add(el.Name); } if (comboBox1.Items.Count != 0) { comboBox1.SelectedIndex = 0; } }
private void LoadCategory() { CategoriesManager = new CategoriesManager(); CategoriesManager.LoadData(); comboBox1.Items.Clear(); comboBox1.Items.Add("All"); foreach (var el in CategoriesManager.Categories) { comboBox1.Items.Add(el.Name); } comboBox1.SelectedIndex = 0; if (ContactList.Items.Count != 0) { ContactList.SelectedIndex = 0; } }