How to Make a Splash Screen

Volte

Neutiquam Erro
Joined
Nov 17, 2002
As simple as it may sound, this is among the more common questions asked, so I made up this example.

This is one of a few ways to make a splash screen, but it's probably the most effective. This shows how to make a real splash screen, which is shown while the program is busy doing some initialization. In this particular instance, it fills a list box with 50,000 items (on my box it takes a few seconds -- if it's too slow on yours, just reduce the number). The concept is very easy:

The whole process is really very simple. The very first thing the main form's load event should do is show the splash screen. After that, do all your initialization processing (i.e. the loop that adds the items). At the end of all the initialization, close the splash screen. The main form won't show until after the Load event completes, so it will work as intended.

The advantage of this method over the others (i.e. setting the startup object to Sub Main and loading both forms separately) is that while the splash screen is open, initialization code can be run from within the form, allowing it to set up form variables and such.




Note: It is my strong opinion that splash screens should never be used as anything other than something to look at while the program is initializing. If the program loads fast enough so that a splash screen is not needed, you should not cause one to appear, and especially not intentionally delay the program from starting just so that you get to see the splash screen.
 

Attachments

  • splashscreen.zip
    14.2 KB · Views: 490
Top Bottom