//Buttons (add/edit or delete) private void btnAddCategory_Click(object sender, EventArgs e) { disableButtons(); Category NewCategory = new Category(); CategoryForm category = new CategoryForm(NewCategory); category.Show(); }
private void btnEditCategory_Click(object sender, EventArgs e) { if (LV_categories.SelectedItems.Count > 0) { //uses selected value to find in the DB and passes it through in the next form var catagoryID = LV_categories.SelectedItems[0].Tag; Category selectedCatagory = Program.db.Categories.Find(catagoryID); CategoryForm EditCategory = new CategoryForm(selectedCatagory); disableButtons(); EditCategory.Show(); } }