Exemplo n.º 1
0
        private void btnCookies_Click(object sender, EventArgs e)
        {
            //This one opens a new form of the Cookie Calories form.
            frmCookies a = new frmCookies();

            a.Show();
        }
        /*
         * This bit of code below sets the functionality of the Next Problem button. It starts off with hiding this window,
         * so as to more seamlessly transition. Then it creates a new form of the next problem in the book, and shows it.
         * The reason I used ShowDialog, as opposed to just Show is that I wanted to switch over to the next problem with
         * no remnants of the previous so it can be properly closed, and using ShowDialog shows the new form modally
         * (making it so directly returning to the previous form [so... THIS form] is impossible), as opposed to Show's
         * nonmodal format. Using Show makes it so the next line of code that is supposed to just close this form instead
         * closes all forms. Still not 100% certain why, but yeah, that happens.
         */
        private void btnNext_Click(object sender, EventArgs e)
        {
            this.Hide();
            frmCookies a = new frmCookies();

            a.ShowDialog();
            this.Close();
        }