コード例 #1
0
        public void Edit_Click(object sender, EventArgs e)
        {
            Button edit       = sender as Button;
            string recipeName = edit.Text;
            Recipe wantToEdit = Form1.FindRecipe(recipeName);

            AddRecipeForm EditForm = new AddRecipeForm();

            EditForm.ShowDialog();

            EditForm.nameBox.Text   = wantToEdit.Name;
            EditForm.timeBox.Text   = wantToEdit.Time;
            EditForm.stepsBox.Text  = wantToEdit.Steps;
            EditForm.ingredBox.Text = wantToEdit.Ingredients;
            EditForm.categBox.Text  = wantToEdit.category;
        }
コード例 #2
0
        /// <summary>
        /// Event handler for the "add" button.
        /// Begins adding a new recipe
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void Add_Click(object sender, EventArgs e)
        {
            AddRecipeForm FormAdd = new AddRecipeForm();

            FormAdd.ShowDialog();
        }