Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I Create many Form in my MainPanel Added To Panel by

Form1 frm = new Form1(this);
frm.TopLevel = false;
frm.AutoScroll = true;
frm.Dock = DockStyle.Fill;
frm.WindowState = FormWindowState.Maximized;
frm.Show();
this.MainPanel.Controls.Add(frm);

which event is running when i switch between forms?
i want to do job when user switch between forms
Posted
Updated 2-Sep-14 22:47pm
v3

Can you try the following event?

private void Form1_Activated(object sender, System.EventArgs e)


this event should fire when ever the form is activated, that is focus is received on this form
 
Share this answer
 
v2
See the Windows Forms Events Lifecycle:

Move: This event occurs when the form is moved. Although by default, when a form is instantiated and launched, the user does not move it, yet this event is triggered before the Load event occurs.
Load: This event occurs before a form is displayed for the first time.
VisibleChanged: This event occurs when the Visible property value changes.
Activated: This event occurs when the form is activated in code or by the user.
Shown: This event occurs whenever the form is first displayed.
Paint: This event occurs when the control is redrawn.
Deactivate: This event occurs when the form loses focus and is not the active form.
Closing: This event occurs when the form is closing.
Closed: This event occurs when the form is being closed.


Refer the Link for details:
http://stackoverflow.com/questions/3070163/order-of-events-form-load-form-shown-and-form-activated-in-windows-forms[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900