Slow dialogbox

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

I bring up a fairly complicated dialog box with:
form2.showDialog().
It takes about 0.5 seconds to come up partly because in
the Load event for the form I get some information from a
database to populate the fields on the form.
The total speed isn't really a problem. For some reason,
some of the text boxes show up without the new background
painted and then the rest of the form is drawn. I'd like
it to all show up at once.

Two questions:
Is there a better place than the load event to put my
database access stuff?
Is there a way to show nothing of the form until
everything is ready and then show it all at once?

Thanks
 
You could try using a splash screen and hiding the base form until your load
is complete.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
This dialog box is brought up long after the application
has started. Is there some way I can do most of the work
of making the dialog box in advance, before doing the
showDialog?
 
Tom,
Have you considered: the constructor itself, a method you call before you
call ShowDialog? To name just a couple ideas...

Hope this helps
Jay
 
Hi Tom,

Why is it a dialogform, I guess that in this case a normal show will be
better.

However I am not sure from what you told.

Cor
 
You could try to add your code into the constructor and see if this makes
any difference. The constrcutor is run before the page load event.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
Thanks to the suggestions given in response to may
question, I have solved the problem. To be more
explicitly about the solution, I had some time consuming
code in the form load handler. This made the form show
partially and then a half second later the complete form
displayed. By opening the section of code at the top
that is labelled "Windows form designer generated code"
and putting my code just beneath the call to
InitializeComponent (where there is a comment that tells
you to put your intialization code), the problem was
fixed and the form now comes up all at once.

What I learned from this is that somewhere between
InitializeComponent and the Load event windows starts
displaying the window.

Tom
 
Back
Top