コード例 #1
0
        //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();
        }
コード例 #2
0
 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();
     }
 }