Form Load

  • Thread starter Thread starter news.microsoft.com
  • Start date Start date
N

news.microsoft.com

Is there any way to preload a form in VB.NET of how can I avoid seeing when
a form is loading, how it is painting all the controls it contains?

I think in VB6 I could use Load(frmTest) and after it is loaded, show it.

Thanks
 
Sub SomeSub()
Dim F as New Form1 <--Loading in memory now
F.ShowDialog <--Now showing the hidden form
End sub

Chris
 
It has to paint the controls. Is it taking a long time to paint? What is
the problem you are seeing? Are you doing a lot of databinding?

Chris
 
No databindig yet, the thing I dont like is that the form loads and I can
see gray boxes where the controls should go, and THEN i see the controls.

Just doesn´t look ok.

Thanks
 
I've never seen that. What is your system specs?

Chris
 
Chris said:
Dim F as New Form1 <--Loading in memory now
F.ShowDialog <--Now showing the hidden form

Mhm... I don't know of another way to show a form without instantiating it
first ;-))).
 
I'm running into the same problem, which is how I found this thread. I'm
developing a survey program that has a parent mainform with five child
forms. Even after the program has been running for a few minutes, I still
see the forms drawing themselves. And, I have them coded using the
technique below. I'm running a 2.0 Ghz Celeron, Windows 2000 Professional
machine with 512MB memory.
 
Hi,

What is the place that you show the form.

The load event is the place where everything can be done before the form is
showed to the screen, however than you should not show it in advance.

I hope this helps

Cor
 
On my main form, I have a menu with a Start Survey option.

Private menuStart_click(...)
dim frmDisclaimer as new form 1
frmDisclaimer.MDIParent = me
frmDisclaimer.Show
me.close
End Sub

However, I still see it "drawing" the controls. I'm thinking of using a
module as startup and having all the forms declared and loaded into memory,
and show them as I need them. Do you think that would improve performance?
 
That´s exactly the problem I have, and i see it in my computer with P4 3.0
Ghz, 1.5 GB RAM.

So I wonder how will it look on slower computers.

Regards,
 
Well, I managed to see a significant increase in performance simply my using
a module as the startup object, and loading all forms into memory, then
showing them as I need them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top