Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detect When WinForm Is Done Loading

Status
Not open for further replies.

RileyCat

Programmer
Apr 5, 2004
124
US
Is there a way to identify when an MDI form is done loading?

I want to perform some activity on my form . . . but not until after the form is done loading. I tried putting my activity at the end of my "FormLoad" function but it's apparently not officially "done" loading until after "FormLoad" is exited.

Ideas? Thoughts? Suggestions?

Thank you!

Stay Cool Ya'll! [smile2]

-- Kristin
 

Add a Timer to your form, and do the following:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'code
'code
'code

Timer1.Interval = 500
Timer1.Start()

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

Timer1.Stop()

RunAfterFormLoad()

End Sub

Private Sub RunAfterFormLoad()

'code
'code
'code

End Sub


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Or you could put the logic in the Shown event for the form.
 
From VS 2008 help:

Form Load
Occurs before a form is displayed for the first time.

I would say that once the form is displayed, it's completely loaded. Also take a look at the OnLoad event
 
I found it best to use the "Shown" event.

Thanks for all the help and input on this one.

Stay Cool Ya'll! [smile2]

-- Kristin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top