Windows Form Shown
-
Hi, guys!. I need one of my forms to do something immediately after the form itself and all the controls are shown (all initialized), but before the user even clicks on anything. THANK YOU! P.S.: I'm not an expert. It's written in C++ .NET using Visual Studio 2010. I tried the Form_Shown event, but it didn't work. Thanks again.
-
Hi, guys!. I need one of my forms to do something immediately after the form itself and all the controls are shown (all initialized), but before the user even clicks on anything. THANK YOU! P.S.: I'm not an expert. It's written in C++ .NET using Visual Studio 2010. I tried the Form_Shown event, but it didn't work. Thanks again.
What you need is Windows.Form.Load Event override. See following link for example https://msdn.microsoft.com/en-us/library/system.windows.forms.form.load(v=vs.110).aspx[^]
-
What you need is Windows.Form.Load Event override. See following link for example https://msdn.microsoft.com/en-us/library/system.windows.forms.form.load(v=vs.110).aspx[^]
Thanks for the suggestion. I'll try it.
-
What you need is Windows.Form.Load Event override. See following link for example https://msdn.microsoft.com/en-us/library/system.windows.forms.form.load(v=vs.110).aspx[^]
Hi! As you suggested, I tried the example in https://msdn.microsoft.com/en-us/library/system.windows.forms.form.load%28v=vs.100%29.aspx[^] Had to change the code a bit, but managed to get it working and added a Form1_Shown event as well. Two things: 1) IMHO, I think that's what I need instead of a Form1_Load event, because I want to add something after the form has loaded and displayed all the controls with their initial values. 2) I have a bigger question now: What's the practical difference between the load event and the constructor code that I can write at the beginning of the form, right after the InitializeComponent() part? Can you help me? THANK YOU, again!
-
Hi! As you suggested, I tried the example in https://msdn.microsoft.com/en-us/library/system.windows.forms.form.load%28v=vs.100%29.aspx[^] Had to change the code a bit, but managed to get it working and added a Form1_Shown event as well. Two things: 1) IMHO, I think that's what I need instead of a Form1_Load event, because I want to add something after the form has loaded and displayed all the controls with their initial values. 2) I have a bigger question now: What's the practical difference between the load event and the constructor code that I can write at the beginning of the form, right after the InitializeComponent() part? Can you help me? THANK YOU, again!
Mateo Hernández wrote:
What's the practical difference between the load event and the constructor code that I can write at the beginning of the form
Please see here: http://stackoverflow.com/questions/2521322/what-setup-code-should-go-in-form-constructors-versus-form-load-event[^] and here: http://stackoverflow.com/questions/3070163/order-of-events-form-load-form-shown-and-form-activated-in-windows-forms[^]
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
-
Mateo Hernández wrote:
What's the practical difference between the load event and the constructor code that I can write at the beginning of the form
Please see here: http://stackoverflow.com/questions/2521322/what-setup-code-should-go-in-form-constructors-versus-form-load-event[^] and here: http://stackoverflow.com/questions/3070163/order-of-events-form-load-form-shown-and-form-activated-in-windows-forms[^]
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
Thank you!!