//buttons private void btnAdd_Click(object sender, EventArgs e) { GlobalVariable.selectedCategoryID = 0; frmCategoriesAdd categoriesAdd = new frmCategoriesAdd(); categoriesAdd.ShowDialog(); lvCategories.Items.Clear(); DisplayCategories(); Hide(); }
private void btnUpdate_Click(object sender, EventArgs e) { /* * Prompts user for selection if nothing has been selected. Assigns CategoryID to * selectedCategoryID variable. Loads edit screen with selected category information */ if (lvCategories.SelectedItems.Count == 0) { MessageBox.Show("Please choose a category to update", "Update Category", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } GlobalVariable.selectedCategoryID = int.Parse(lvCategories.SelectedItems[0].SubItems[1].Text); frmCategoriesAdd editForm = new frmCategoriesAdd(); editForm.ChangeAddToEdit("Edit Category", " Edit Category Details", "Update"); editForm.ShowDialog(); lvCategories.Items.Clear(); DisplayCategories(); Hide(); }