private void btnAdd_Click(object sender, EventArgs e) { GlobalVariables.selectedCategoryID = 0; frmCategoriesAdd editForm = new frmCategoriesAdd(); editForm.ShowDialog(); // repopulate list view with updated category details lvCategories.Items.Clear(); DisplayCategories(); }
private void btnUpdate_Click(object sender, EventArgs e) { if (lvCategories.SelectedItems.Count == 0) { MessageBox.Show("Please select a Category to update"); return; } GlobalVariables.selectedCategoryID = int.Parse(lvCategories.SelectedItems[0].Text); frmCategoriesAdd editForm = new frmCategoriesAdd(); editForm.ShowDialog(); // repopulate list view with updated category details lvCategories.Items.Clear(); DisplayCategories(); }