Using windowsform: Execute code when form loaded and before Form closes on newest questions tagged winforms – Stack Overflow
I’m currently working on an application that uses a Windows Form GUI. The main work of the application will be performed on an additional thread – but it is possible that it will be dependent on the state of the form.
Because of this, before I create the thread I must make sure that the form is completely loaded. Also, I need to make sure the thread is terminated before the form begins closing.
Possible solutions for this problem might be overriding the
OnShow method really gets called only after ALL of the assets of the form have been loaded? And what about the
OnFormClosing – can I be sure that any code executed in this method will be performed before the form begins close / dispose?
Using windowsform: using-windowsform