Library tutorials & articles

Splash Screens

Showing it

To show the splash form when the application is loading, whatever method you used to create the form, you need to set a few properties and add a few lines of code.

First, select Project | Properties... Select the General Tab, and change the Startup Object drop down to Sub Main.

Now, select Project | Add Module . Select Module from the list of items. Note, if you already have a module in your project, then you do not need to add a new one.

Then insert the following code into that new module:

Sub Main()
    ' Show the splash form
    frmSplash.Show
    ' Load the main form
    Load frmMain
    ' Load any other forms you may have that you need
    ' Show the main form
    frmMain.Show
    ' Remove the splash form from the memory
    Unload frmSplash
End Sub

If the splash screen does not appear for long enough, that is because your program is too small! To get round this, you can add a timer to the splash screen so that it will appear for x number of seconds. Add the control, name it tmrShow, set its Interval property to 2000 (2 second) and add the following code to the splash form:

Private Sub tmrShow_Timer()
    tmrShow.Enabled = False
    ResumeStartup 'resume the startup
    Unload Me 'unload the form (hide it)
End Sub

Then, modify the module startup code:

Sub Main()
    ' Show the splash form
    frmSplash.Show 'as the form loads, the timer will start
End Sub

Sub ResumeStartUp()
   ' Load the main form
    Load frmMain
    ' Load any other forms you may have that you need
    ' Show the main form
    frmMain.Show
End Sub

Comments

  1. 20 May 2005 at 02:09

    i am running vb.net 2003. I cannot get the code for a splash screen to work. It is possible for u to send me code so it will work. Thanks

  2. 04 Oct 2004 at 23:39

    Hi,
    I am working on a VB.NET application and wanted to implement a Splash screen, I have created a form from Scratch and pasted my .jpeg file on that form. In my main function, I have created an instance of that form
            dim splash as frmSplash
            splash = new frmSplash()


            splash.show()
    at this point, I can see a window only on the Windows task bar but not displayed on Screen. after this a statement is executed for main form i.e.
            frmMain.showDialog()
    after this statement, screen appears above main form.


    When i use
            splash.showDialog() in place of splash.show(),
    the screen appears as required but application will not proceed furthur. It is not moving to next statement at all.
    how can i correct this problem?

  3. 23 Feb 2004 at 15:44
    that bits obvious, but where about in the coding bo you put the interval bit (no, i cant read very well by the way)
  4. 17 Nov 2002 at 04:33

    Add a timer to the splash form and click on it to edit the properties

  5. 19 Jul 2002 at 14:27

    where do you put the interval


  6. 01 Jul 2002 at 19:14

    It is a good one, simple and to the point

  7. 23 Jan 2002 at 06:41
    thanks for the great tutorial, it was very easy to understand

    Thanks
    Mark
  8. 01 Jan 1999 at 00:00

    This thread is for discussions of Splash Screens.

Leave a comment

Sign in or Join us (it's free).

James Crowley James first started this website when learning Visual Basic back in 1999 whilst studying his GCSEs. The site grew steadily over the years while being run as a hobby - to a regular monthly audience ...
AddThis

Related discussion

Related podcasts

  • Christian Beauclair

    14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...

We'd love to hear what you think! Submit ideas or give us feedback