Matthias Posted December 7, 2003 Posted December 7, 2003 Usually I do initialisation routines in Form.OnLoad Events (i code vb.net), but the problem with this event is, that it fires BEFORE the Form is displayed. Some things (especially if they take some time) should start the moment the form is finished loading. (so we can give visual feedback over the progress) There are events like OnActivated, but they have the disadvantage of beeing called every time the Form is activated and not only the first time. I usually do a workaround with the Activated-Event, but this is not really satisfying. Is there a better way? How do you solve this? Quote
*Experts* mutant Posted December 7, 2003 *Experts* Posted December 7, 2003 You should think about making a spalsh screen for that kind of thing. Here is one example: http://www.xtremedotnettalk.com/showthread.php?s=&threadid=77706 Quote
Matthias Posted December 7, 2003 Author Posted December 7, 2003 Thanks for the tip, but most of my programs do have splash screens. But this doesn't help for forms which appear much later in the work-process. Furthermore I am looking for an elegant, simple solution, like e.g. some methode for finding out if a form's elements are finished loading. Quote
Mothra Posted December 8, 2003 Posted December 8, 2003 If you know what parts are taking the time, you could kick them onto their own threads. Then you can get the progress for those items and kick it to a progress bar or update a small label with the current progress. Quote Being smarter than you look is always better than looking smarter than you are.
Klogg Posted December 8, 2003 Posted December 8, 2003 If I'm interpreting your question correctly, you want to show the controls and stuff in the form before the code in FormLoad executes. If this is the case, try putting Me.Show() at the beginning of the FormLoad sub procedure. Quote Take a look at my programs. Go to my web site.
Matthias Posted December 8, 2003 Author Posted December 8, 2003 @mothra: this doesn't solve the problem. the problem is when exactly to start time consuming operations (with or without visual feedback) therefore it would pe practicable to know, when exactly the form is finisched loading. @Klogg: I am not sure if I already tried this, but I fear that the event form.load is fired BEFORE the form loads by definition and therefore I can hardly imagine that a "me.show" would do anything in this situation. The form already got that command when the load event fires. But I will try and tell you if it worked. Also I am not interested to change anything with the Load event, because I usually need it the way it is. I only need an additional event or something alike to start processes AFTER the loading of the form. (when the form drawing is finished) It doesn't help to call anything from the form.load eventhandler, because the form will always fail to display before the Form_Load Procedure is completely finished. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.