rdinfo
asked on
How to Fire an event only after windows form has completely finished loading?
I have a vb.net application with a form that does some heavy processing on form load. I would like to do this processing once the form has completely loaded and visible to the user. (So after form load has been completed and all controls and images have loaded) to decrease flickering and loading time of the actual form.
Is this possible? if so, how would i go about doing so?
Thanks
Is this possible? if so, how would i go about doing so?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks.. That worked brilliantly for me!! Just what i needed!
That allows you to control the time, but if you what to start immediately after the form shows, you can use the Peter suggestion (don't forget to use Application.DoEvents() in the beginning of the event)
You could also force the form to show in the Load() event like this:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Show()
Application.DoEvents()
' ... rest of your code...
End Sub
End Class
>> You could also force the form to show in the Load() event like this:
Never done that, but it's a nice trick! :)
Never done that, but it's a nice trick! :)
Or you could use the Shown event.
/peter