Splash Screens in VB 2005

One of the things we provided in the application model for VB is the ability to easily integrate a splash screen into your application. We take care of displaying it, making sure it displays for at least some user specifiable period of time, and taking it down once your application's main form is ready to display.

One of the things that throws people is how to set the minimum amount of time for the splash screen to display. Admittedly, we have some work to do to make this easier. 

For now, if you don't like the default two second minimum, you can specify your own minimum in milliseconds by overriding the OnInitialize method on the MyApplication class. Here's how you do it (and note that all of this presupposes that you have the application model enabled in the first place):

Go to the project designer by double-clicking the 'My Project' node in your solution. Once you've specified which form is to be your splash screen, click the View Application Events button. You'll see a MyApplication class inside the My namespace. Go in that class and add an override to OnInitiliaze like this:

Protected Overrides Function OnInitialize(ByVal commandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String)) As Boolean
Me.MinimumSplashScreenDisplayTime = 5000
Return MyBase.OnInitialize(commandLineArgs)
End Function

Now the splash screen will stay up a minimum of five seconds.

The splash screen displays early on in your applications startup. The idea is to have that displaying until your main form is ready to display. Then we take it down unless you've specified a minimum 'face time' that you want for your splash screen. Once the minimum splash time expires we take the splash screen down. Just set it to zero if you want it taken down automatically once your main form has completed loading.

All of this exposes you to a variety of things going on behind the scenes. Next time I'll write about the application model and what the sequence of events is when an app that uses the new application model starts up.