Splash Screen... Delay?

Hello,
I made this splash screen and since I just started working on my project,
the app takes less than two seconds to load and the time for splash screen...
.....is not enough....

I have tried to put

System.Threading.Thread.Sleep(5000)

but where

I put it in the code of the splash screen, then it waits 5 seconds before showing the splashscreen

and I put it in the main program, then the
splash screen is out THEN it waits 5 seconds after the splash screen is gone
THEN it loads....

I am very lost...

Thank You for any reply!
Keehun Nam




Answer this question

Splash Screen... Delay?

  • jledgard

    This code realy help me.

    I have change the delay time to 5 sec using the MinimumSplashScreenDisplayTime property. However, the splash screen and the mainform show up almost at the same time. The splash screen site on top of the main form for 5 sec then disappear. What I'd like to do is to show the splash screen for 5 sec, then make it disappear, then show the mainForm. Any advice

    Thanks


  • Alwyn Rozario

    If you really want to put your wait code in the splash form, you would put your sleep call in Form_Load, but call Me.Show first.

  • Perseid

    This is all well and good, but what happens if opening the ApplicationEvents.vb does nothing The file opens, but it is blank. Any help would be appreciated.

    Cheers
    Jacob


  • HeatherS2006

    This works in VB 2005, all SKU's from Express to VSTS

    Whats not working

    You are using 2005


  • danielwetzler

    I would like to know this as well. The other posts were not very helpful to me.
  • Nksingh

    If you'd like to see how to bypass the splash screen

    during program start-up, see:

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=768807&SiteID=1



  • Craig68

    If you want to change the default splash screen display time, then in the project property's Application page, click on "View Application Events".  This will create a new file ApplicationEvents.vb.  Open the Partial Friend Class MyApplication in that file, add this code:

    Protected Overrides Function OnInitialize(ByVal commandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String)) As Boolean

    'Set the splash screen timeout.

    Me.MinimumSplashScreenDisplayTime = 5000
    Return MyBase.OnInitialize(commandLineArgs)

    End Function

    Cathal


  • CET PRG455

    Your code to delay the splash screen works great. Thanks!

    How do I make the splash screen to sit there until the user clicks on it

    Thanks in advance!

    JE


  • Baris Guner

    TedWagner wrote:
    I would like to know this as well. The other posts were not very helpful to me.

    Ahhhhhh, Ok. Sorry, I figured it out. Works very nice.

    From the solutions explorer, right click on your project and chose properties.

    To the left are your properties tabs.

    Top one is application. Click on it.

    (make sure you've added the splash screen item)

    Near the bottom is the splash screen selector. Select the splash screen vb item you just added.

    Click on the "view application events" button.

    Code should look like this:

    Namespace My

    ' The following events are availble for MyApplication:

    '

    ' Startup: Raised when the application starts, before the startup form is created.

    ' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.

    ' UnhandledException: Raised if the application encounters an unhandled exception.

    ' StartupNextInstance: Raised when launching a single-instance application and the application is already active.

    ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.

    Partial Friend Class MyApplication

    'Begin code paste below

    Protected Overrides Function OnInitialize(ByVal commandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String)) As Boolean

    'Set the splash screen timeout.

    Me.MinimumSplashScreenDisplayTime = 5000

    Return MyBase.OnInitialize(commandLineArgs)

    End Function

    'End code paste

    End Class

    End Namespace


  • Leo Pedersen

     Cathal Connolly wrote:
    If you want to change the default splash screen display time, then in the project property's Application page, click on "View Application Events".  This will create a new file ApplicationEvents.vb.  Open the Partial Friend Class MyApplication in that file, add this code:

    Protected Overrides Function OnInitialize(ByVal commandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String)) As Boolean

    'Set the splash screen timeout.

    Me.MinimumSplashScreenDisplayTime = 5000
    Return MyBase.OnInitialize(commandLineArgs)

    End Function

    Cathal

     

    I have tried this and it does not work. What is the correct solution to display a splash screen for longer than 2 secs

     

     

    Thanks.



  • dimzon

    On the solutions explorer, look for the Application.Designer.vb under Application.myapp, which is under the My Project folder.  Paste the code there.  It should work as well.

    The code should look something like this.  Look for the splash screen delay code at the bottom:

     

    '------------------------------------------------------------------------------

    ' <auto-generated>

    ' This code was generated by a tool.

    ' Runtime Version:2.0.50727.42

    '

    ' Changes to this file may cause incorrect behavior and will be lost if

    ' the code is regenerated.

    ' </auto-generated>

    '------------------------------------------------------------------------------

    Option Strict On

    Option Explicit On

     

    Namespace My

    'NOTE: This file is auto-generated; do not modify it directly. To make changes,

    ' or if you encounter build errors in this file, go to the Project Designer

    ' (go to Project Properties or double-click the My Project node in

    ' Solution Explorer), and make changes on the Application tab.

    '

    Partial Friend Class MyApplication

    <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _

    Public Sub New()

    MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)

    Me.IsSingleInstance = true

    Me.EnableVisualStyles = true

    Me.SaveMySettingsOnExit = true

    Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses

    End Sub

    <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _

    Protected Overrides Sub OnCreateMainForm()

    Me.MainForm = Global.MyApp1.Form1

    End Sub

    <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _

    Protected Overrides Sub OnCreateSplashScreen()

    Me.SplashScreen = Global.MyApp1.SplashScreen1

    End Sub

    Protected Overrides Function OnInitialize(ByVal commandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String)) As Boolean

    'Set the splash screen timeout.

    Me.MinimumSplashScreenDisplayTime = 4000

    Return MyBase.OnInitialize(commandLineArgs)

    End Function

    End Class

    End Namespace

     

    I hope it helps.  It works on Visual Studio 2005.


  • wooks

    This code realy help me.

    I have change the delay time to 5 sec using the MinimumSplashScreenDisplayTime property. However, the splash screen and the mainform show up almost at the same time. The splash screen site on top of the main form for 5 sec then disappear. What I'd like to do is to show the splash screen for 5 sec, then make it disappear, then show the mainForm. Any advice

    Thanks


  • maxnis

    Well, I tried to put the system.sleep thing but
    I either delays before the splash comes up
    or, after splash, or either when drawing the splash
    so that the splash it all jurky at the beginning because
    it seems like it takes like a two second break after like fifty pixels it drew on the screen...

    Thank you anyway!
    Keehun Nam

  • Splash Screen... Delay?