The Form.Shown event is a good place for any initialization that can take more than one second. Form.Shown happens only once, right after the form first becomes visible to the user.
Obviously, if you have a lengthy initialization, you still need to provide some kind of visual feedback and possibly turn off sections of the form before completion. But if initialization is unavoidable, Form.Shown at least allows you to let the app know that it's not frozen, and give feedback on what it actually does.
Compared to Form.Load: from the point of view of users, your application will be perceived faster because your form is already displayed during initialization.
Compared to Form.Activated: you donβt have to worry about your initialization being done several times, because an activated event is fired every time your form is hidden / shown, minimized / maximized, etc.
Compared to the constructor: Like Form.Load, your form will not be visible until initialization is complete. In addition, you should be more careful about timing and sequence issues associated with controls that may not be fully initialized.
Ash
source share