Form Loading very slow

  • Thread starter craig rose via .NET 247
  • Start date
C

craig rose via .NET 247

Hi All

I have a Winforms App writing in vb.net
IT has a Main MDI Form called frmMain.

When ever I create a new object of an existing form and then show it , it takes a long time to render when a child form creates another form object.
All I?m doing is calling the form object's show or showDialog methods.

This looks very ugly and unprofessional.

As a result I?ve had to develop a 'pre' buffer for the forms on startup with a loading sequence as the next time they are called they show instantly.

eg.

Public Sub PreLoadForms()

Dim objFrmClient As New FrmClient
Dim objFrmCompany As New FrmCompany
...
...

objFrmClient = Nothing
objFrmCompany = Nothing
End Sub


Does any one know why it takes so long to render a form if it?s called from a child form?

And is this the most efficient work around?
 
H

Herfried K. Wagner [MVP]

* craig rose via .NET 247 said:
I have a Winforms App writing in vb.net
IT has a Main MDI Form called frmMain.

When ever I create a new object of an existing form and then show it , it takes a long time to render when a child form creates another form object.
All I?m doing is calling the form object's show or showDialog methods.

This looks very ugly and unprofessional.

As a result I?ve had to develop a 'pre' buffer for the forms on startup with a loading sequence as the next time they are called they show instantly.

Dies this even occur with a "blank" form or a form with some controls
but without "implementation"?
Public Sub PreLoadForms()

Dim objFrmClient As New FrmClient
Dim objFrmCompany As New FrmCompany
...
...

objFrmClient = Nothing
objFrmCompany = Nothing

Don't set the variables to 'Nothing', this is done automatically.
 

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

Top