Click here to Skip to main content
16,004,574 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've got some issues with my Splash Screen in VB 2010 Express. The screen shows up like it's supposed to, and everything works, but no matter what I change the timer's interval property to, the screen still goes away after about 4 seconds. I need it to stay for at least 10. Some help would be appriciated!
Posted

1 solution

In that comment you wrote under the other answer, it looks like you are closing the main form and then opening the main form (i.e., rather than closing the splash screen). To change the duration of the splash screen, go to the Application tab and click "View Application Events". You will see the MyApplication class. In it, add the following function:
VB.NET
Protected Overrides Function OnInitialize(commandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String)) As Boolean
	Me.MinimumSplashScreenDisplayTime = 10000
	Return MyBase.OnInitialize(commandLineArgs)
End Function

I tried this after finding that info here: http://www.sourcecodester.com/tutorials/net/how-create-a-splash-screen-vbnet.html

EDIT: The ApplicationEvents.vb file should look like this:
VB.NET
Namespace My

    ' The following events are available 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

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

    End Class

End Namespace
 
Share this answer
 
v2
Comments
Member 7875079 26-Apr-11 22:35pm    
I've already tried that, as I've done several searches for this issue. I get an error, none of it is recognized by the system.
AspDotNetDev 26-Apr-11 22:53pm    
What error? Was it a compile error or a runtime error?
Member 7875079 26-Apr-11 23:33pm    
It tells me statement is not valid in a namespace during compiling; it won't even let me run it. Assuming that I'm putting it in the correct spot, which I followed your instructions...
AspDotNetDev 26-Apr-11 23:41pm    
Copy all the text in the file you pasted the code into and paste it into your question. Also, post the EXACT error message in your question. Then post a comment here to let me know once you've done that and I'll take a look.
Member 7875079 26-Apr-11 23:58pm    
That was the exact error message. "Statement is not valid in a namespace" It's under ApplicationEvents.vb, and I just pasted everything that you wrote, the
Protected Overrides Function OnInitialize(commandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String)) As Boolean
Me.MinimumSplashScreenDisplayTime = 10000
Return MyBase.OnInitialize(commandLineArgs)
End Function

part of it. Is that what you needed?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900