Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

Posted

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.

Posted
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.
Being smarter than you look is always better than looking smarter than you are.
Posted
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.
Take a look at my programs. Go to my web site.
Posted

@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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...