Form Finished Loading

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi There

I'd like to call a function when a form is fully loaded (and visible). For
now I am using "Activated" event handler + a "first time flag" to do it. Is
there any better way?.

Thanks,
 
You could do the same kind of thing in an override of the Form's
OnPaint.

protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);

if (firstTime)
{
//...
firstTime = false;
}
}

=========================
Clay Burch
Syncfusion, inc.
 
Clay

I am trying to avoid this first time flag.
I can use Activated, Visible and as you said Paint event handlers to do
this, however i was looking for something like LoadFinished! event and I
don't think there is anything even similar to that, I think i have to stick
with this "First time load" flag.

Thanks for your help.
 
If you are on .NET 2.0, Win form has an even "Shown", whuch is designed for
exactly your need. If you use .NET1.x, you have to stick with your current
approach, I am afraid.
 
Norman

That is a great point, i didn't know that
Unfortunately i am using 1.1 for this application, but i'll consider "Shown"
event for future ones

Thank you very much
 

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