How do I execute code AFTER a form has loaded?

adeel825 picture adeel825 · Oct 20, 2008 · Viewed 169.8k times · Source

In .NET, Windows Forms have an event that fires before the Form is loaded (Form.Load), but there is no corresponding event that is fired AFTER the form has loaded. I would like to execute some logic after the form has loaded.

Can anyone advise on a solution?

Answer

Matthias Schippling picture Matthias Schippling · Oct 20, 2008

You could use the "Shown" event: MSDN - Form.Shown

"The Shown event is only raised the first time a form is displayed; subsequently minimizing, maximizing, restoring, hiding, showing, or invalidating and repainting will not raise this event."