The magazine of the Melbourne PC User Group

Seeing the Basics: Making a splash with Visual Basic 6.0

Tony Stevenson

Professional applications often display a splash screen whenever they're launched by users. For example, Word's splash screen contains copyright information and a version number, along with details of the product's licensee.

Now Visual Basic 6.0 makes it easy to create a splash screen for your own applications.

The advantages of incorporating a splash screen into an application include the following:

  • It gives any Visual Basic program you write a professional look, but without having to expend a lot of time and effort in doing so
  • It's an effective way of advertising who's written the program - and that's you. And because users will see the splash screen each time they start your application, they'll have constant exposure to your name and company. If you want to, you can even include some graphics or animations to make the splash screen more visually appealing
  • Although a splash screen only displays for a few short seconds when a program is initiated, it still provides sufficient time for some program initialisation to be carried out. By giving users something to look at, they'll be distracted long enough for the initialisation process to be completed successfully, without them ever noticing the delay.
H owever, there is one important trap to watch out for when developing a splash screen.

Because a splash screen in a Visual Basic program is really just another form, the more controls it contains, along with the associated code, the longer it will take to load, and therefore display.

So while it's very tempting to create a whizz-bang splash screen, resist the urge strongly. Limit the number, and type, of controls you use.

While users will undoubtedly marvel at your brilliant work the first or second time they see it, the reality is that, unfortunately, they'll soon tire of it. After all, they've installed your Visual Basic program on their computer to do some useful work, and not to admire the beauty of your splash screen.

Nothing turns users off more quickly than applications that run sluggishly. So don't unnecessarily prejudice your own work by writing programs that load slowly.

If you've never programmed a splash screen with Visual Basic before, there are a couple of alternative ways of getting started.

Method 1 for adding a splash screen to a VB program

The first method is to use Visual Basic 6.0's Application Wizard to create a new program from scratch, and to include a splash screen as part of it. To do so, complete the following steps:

  1. Start a new project by clicking "File" on the main Visual Basic design menu, followed by the "New Project" option.
  2. When the "New Project" dialog appears, double click the "VB Application Wizard" icon.
  3. Now simply follow the various instructions that appear on the different dialogs that are presented by the Application Wizard.
  4. The Wizard will eventually display the "Application Wizard Standard Forms" dialog. This is where you specify that you want to incorporate a splash screen into your application. Just make sure that the check box labelled "Splash screen at application start up" contains a tick mark.
  5. Then answer the questions in the remaining dialogs, and finally instruct the Wizard to generate your new application.


Figure 1. When developing a Visual Basic program from scratch, use the functionality of the Application Wizard to easily incorporate a splash screen.


Figure 2.  Visual Basic 6.0 comes with a handy Form Template for adding a splash screen to any of your existing VB programs


Method 2 for adding a splash screen to a VB program

The second way to add a splash screen is to incorporate it into one of your existing programs. This is achieved using Visual Basic 6.0's built-in Form Templates functionality. As well as a template for a splash screen, there are also ones for a "Log in Dialog", "Tip of the Day", "About Dialog", and so on.

Here's the procedure to follow:

  1. Open a Visual Basic application you've previously written, and click "Project" on the main Visual Basic design menu, followed by the "Add Form" option. When the "Add Form" dialog appears, make sure the "New" tab is selected, and then double click the "Splash Screen" icon.
  2. Next, make the changes to the splash screen to suit your own particular requirements, for example, add your personal or company contact details.
    A word of warning: Be aware that the caption of the label "lblProductName" on the splash screen is automatically set by code generated when the splash screen was added to your application. You'll have to manually alter this code to get the display you want.
  3. Click "Project" on the main Visual Basic design menu, followed by "Project1 Properties...". Make sure the "General" tab is selected, and in the drop down list box labelled "Startup Object", select the splash screen entry (frmSplash) and click "OK". This tells Visual Basic that the first form to be displayed is the splash screen.
  4. Now run the program to see what your new splash screen looks like. It's really that easy.
Always consider your users

As much as you've become captivated by your own splash screen, it's considered polite programming to allow users a quick way of getting rid of it. And the easiest way is to let them press any key on the keyboard to make it disappear. To do so, put the required code ("Unload Me") in the KeyPress event of the splash screen form.

Reprinted from the February 1999 issue of PC Update, the magazine of Melbourne PC User Group, Australia

[About Melbourne PC User Group]