Slide 9.3: An example of multiple forms
Slide 9.5: The switch statement
Home

An Example of Multiple Forms (Cont.)


To create another form, select the VS options:
   Project ⇒ Add Windows Form...
Pick the template “Windows Form” and give a form name such as Form2.cs:


A PictureBox is used to display the image. The keyword this provides a way to refer to the specific instance of a class or structure in which the code is currently executing.

 using System;
 using System.Windows.Forms;
 namespace WindowsFormsApp4 {
   public partial class Happy : Form {
     public Happy( ) { InitializeComponent( ); }

     private void Button1_Click( object sender, EventArgs e ) {
       Form f = new Home( );
       f.Show( );
       this.Hide( );
     }
   }
 }