AllTheTimeWorld.com

csharp dialogsAdd the code for New and Exit: The last of the Happy Birthday App

Add the code for New and Exit: The last of the Happy Birthday App

Shows how to save and restore the form settings at start

Add the code for New and Exit: The last of the Happy Birthday App

Shows how to save and restore the form settings at start


Text of video

Write the code as shown below:

   public partial class Form1 : Form
    {
        // These variables will be used to restore the original state.
        Font startFont;
        Color startColor;
        public Form1()
        {
            InitializeComponent();
            // Store the current font and color.
            startFont = lblHappy.Font;
            startColor = this.BackColor;
        }

        private void mnuExit_Click(object sender, EventArgs e)
        {
            // Closing the form closes the app.
            this.Close();
        }
Complete code for Happy Birthday app