Resolved Splashscreen appears but main form opens immediately?

Matt_h

Member
Joined
Apr 12, 2007
Messages
17
Programming Experience
Beginner
I have an application with a main form, on loading the main form asks the user to select a file to work with. I have now been asked to add a splashscreen to the project so did the following:

* Right clicked in solution explorer and added the splashscreen
* Went into project properties and added the splashscreen to the dropdown for splashscreen and then clicked "View Application Events"
* Within here I have added the following code:

VB.NET:
Protected Overrides Function oninitialize(ByVal commandlineargs As System.Collections.ReadOnlyCollection(Of String)) As Boolean

Me.MinimumSplashScreenDisplayTime = 5000
Return MyBase.OnInitiallize(commandlineargs)

End Function

Now when I run the application the splash screen shows but within, a second the openfiledialog has appeared and hides the splash screen.

Commenting out the code above I still get the same effect.

What have I done wrong?

regards,

Matt
 
Last edited:
I think I have sorted it by moving the code that I had to open the file dialog from the forms load event and moving it to the gotFocus event.

regards,

Matt
 
Thought I had it solved but putting the code into the gotfocus event doesn't appear to work.

Tried adding it to the activated event but as the main form loads after the splash screen it gets stuck in a loop - presumeably because the activated code is run multiple times and then causes an error.

So what would be the correct way to handle the splash screen and then as soon as the splash screen closes and the main form loads an open file dialog opens up. Suppose could put it into the lostfocus event of the splash screen but as it's an event alied to the main form it doesn't seem right to do this.


regards,

Matt
 
Back
Top