Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# - are there any events fired right after loading a form?

I want to give the user the option to use a tutorial, the first time he uses the program. I tried adding it in the Form.Load event, but the forms shows up after the Messageboxes have popped up.

That's why I would like to know, are there any events fired right after loading a form?

If not, is there a way to perform actions right after loading?

like image 494
Simon Verbeke Avatar asked Dec 04 '22 06:12

Simon Verbeke


1 Answers

You could try using the Shown event but that might be a bit early too based on what you are doing but it does occur after the Load.

If you have any controls on the page you could trigger it off the controls GotFocus event. Just make sure to put in checks to only do it once if using the GotFocus method.

MSDN Form.Shown

MSDN Control.GotFocus

MSDN Reference to order of events

System.Windows.Forms.Control.HandleCreated

System.Windows.Forms.Control.BindingContextChanged

System.Windows.Forms.Form.Load

System.Windows.Forms.Control.VisibleChanged

System.Windows.Forms.Form.Activated

System.Windows.Forms.Form.Shown

like image 97
Kelsey Avatar answered Dec 18 '22 02:12

Kelsey