Live Chat Icon For mobile
Live Chat Icon

When I try to catch the Resize event to handle sizing of MDI children, the event is called even before my form’s constructor can create the children throwing an exception. How do I avoid this

Platform: WinForms| Category: Tips

The Resize event is getting raised before the constructor completes because the form is being resized in the constructor. If you are using VS.NET to create your project, then in your constructor there is a call to InitializeComponent. In this method there is code to resize the form. You could instantiate your child form in your constructor *before* InitializeComponent is called, then when the form gets resized for the first time you already have an instance of your child form.


Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.