Created
August 11, 2014 08:02
-
-
Save jjokela/0b198a21b4cea3609a54 to your computer and use it in GitHub Desktop.
WinForms Lifecycle Events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Windows.Forms; | |
namespace WinFormsLifecycleEvents | |
{ | |
public partial class Form1 : Form | |
{ | |
public Form1() | |
{ | |
InitializeComponent(); | |
} | |
/* | |
Output: | |
Form.Load | |
Form.Shown | |
Form.Closing | |
Form.Closed | |
*/ | |
private void Form1_Load(object sender, EventArgs e) | |
{ | |
System.Diagnostics.Trace.WriteLine("Form.Load"); | |
} | |
private void Form1_Shown(object sender, EventArgs e) | |
{ | |
System.Diagnostics.Trace.WriteLine("Form.Shown"); | |
} | |
private void Form1_FormClosing(object sender, FormClosingEventArgs e) | |
{ | |
System.Diagnostics.Trace.WriteLine("Form.Closing"); | |
} | |
private void Form1_FormClosed(object sender, FormClosedEventArgs e) | |
{ | |
System.Diagnostics.Trace.WriteLine("Form.Closed"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment