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?



--------------------------------
From: craig rose

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>VQf3jwChN0uCXDzryzEdkw==</Id>

Re: Form Loading very slow by hirf-spam-me-here

hirf-spam-me-here
Fri Apr 23 10:01:20 CDT 2004

* craig rose via .NET 247 <anonymous@dotnet247.com> scripsit:
> 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.

> End Sub

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>