I am trying to figure out when an event occurs Form.Load. On MSDN it sais:
Occurs before the form is displayed for the first time.
But when is the form first displayed? My first instinct was right after InitializeComponent(), but when I tried the following code, it MessageBoxshowed 5, although the value was set after InitializeComponent(), so it was not right after InitializeComponent():
public partial class Form1 : Form
{
private int number;
public Form1()
{
InitializeComponent();
number = 5;
}
public void Form_Load(object sender, EventArgs e)
{
MessageBox.Show(number);
}
}
So, when does this happen?
source
share