Skip to content

Instantly share code, notes, and snippets.

@koffisani
Created March 15, 2016 10:56
Show Gist options
  • Save koffisani/ea4869bcfdb1a496672a to your computer and use it in GitHub Desktop.
Save koffisani/ea4869bcfdb1a496672a to your computer and use it in GitHub Desktop.
A brief code for openning a window after closing the first one in C#
private void OnButton1Click(object sender, EventArgs e)
{
this.Hide(); //On cache la fenêtre courante
var form2 = new Form2(); //On instancie la seconde
form2.Closed += (s, args) => this.Close(); //On notifie à la première de se fermer au moment où la seconde se ferme
form2.Show(); //On affiche la seconde
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment