/// <summary> /// When the Add Electronics button is clicked, open up a new form /// and then repopulate the list when it is closed. /// </summary> private void addElectCmd_Click(object sender, EventArgs e) { addElectFrm addForm = new addElectFrm(); addForm.ShowDialog(); List <Electronic> allElectronics = ElectronicDb.GetAllElectronics(); populateList(allElectronics); }
/// <summary> /// When the Update Electronic button is pressed, open up a new form /// with the information of that electronic already populated. The user may /// then update any information regarding the electronic. After closing, /// the listbox is once again repopulated. Displays an error /// message if there is no electronic selected. /// </summary> private void updateElectCmd_Click(object sender, EventArgs e) { if (productLstBox.SelectedIndex < 0) { MessageBox.Show("You must choose a product to update."); return; } Electronic electToUpdate = productLstBox.SelectedItem as Electronic; addElectFrm updateForm = new addElectFrm(electToUpdate); updateForm.ShowDialog(); populateList(ElectronicDb.GetAllElectronics()); }