On Wed, 30 May 2007 13:52:01 +0100, John Dann wrote:
Something very simple that I can't spot how to do:
I wand to display a msgbox showing some current configuration
parameters when my VB2005 program starts up. However, I want the main
form to paint before the msgbox appears so that the main form appears
as the background to the msgbox. At present I just have the msgbox as
the last item in the Form.Load procedure but not surprisingly it's
appearing on its own and out of context before the main form is
visible.
Is there any event-dependent way of doing this other than using timers
of one sort or another?
Use the Activated event instead of the Load event. The Activated event is
raised whenever the window has been shown on the screen. Note that this
event is raised *everytime* the window is shown on the screen (when it's
unminimized for example), so you'll want to unsubscribe from the event or
use a boolean flag to only show your message box the first time the event
is raised.
I think that in .NET 2, there is a new event that's raised only once the
first time that the window is shown. I haven't switched to .NET 2 yet so I
forgot the name but you might want to look for it.