Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB
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 26-Apr-11 13:47pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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:
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:
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
  Permalink  
v2
Comments
Member 7875079 at 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 at 26-Apr-11 22:53pm
   
What error? Was it a compile error or a runtime error?
Member 7875079 at 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 at 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 at 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?
AspDotNetDev at 27-Apr-11 0:01am
   
No, that's the part I gave you. You should have pasted that inside a class. And that class should have had some code comments and such. Paste everything in that file here.
Member 7875079 at 27-Apr-11 0:05am
   
Then obviously I misinterpreted where it needed to go, as there was nothing else on that page when I got to it. Does this code need to be put in the Timer's code? Or on the splash page itself? I'm confused on that.
AspDotNetDev at 27-Apr-11 0:16am
   
See my updated answer.
Member 7875079 at 27-Apr-11 0:18am
   
I'm afraid I don't understand that. I'm only a beginner at this stuff, I've been working with VB 2010 Express for less than 5 months.
AspDotNetDev at 27-Apr-11 1:04am
   
What part doesn't make sense?
Member 7875079 at 27-Apr-11 12:09pm
   
All the commented stuff. Do you want me to put code there? If so, what code? And why does all this need to happen anyway? The Splash screen opens when it's supposed to, and the Main form opens properly afterwards. The only issue is that the Timer's interval property doesn't seem to be working right.
AspDotNetDev at 27-Apr-11 12:40pm
   
All the "commented stuff" was there by default, and should have been the same for you if you followed the instructions at the link in my answer. Why are you using a timer? You don't need one. See the code that says "Me.MinimumSplashScreenDisplayTime = 10000"? That sets the splash screen to show for 10 seconds. Look at the link again and start a new project from scratch. Should take all of 3 minutes.
Member 7875079 at 27-Apr-11 12:53pm
   
I was using a timer cause that was the only way I'd been taught to do it. For some reason all of the comments and extra coding wasn't showing up in this project, I had to copy and paste it there myself. It works now, but the Splash screen doesn't go away like it was before, it just stays there behind the main form. How do I make it close?
AspDotNetDev at 27-Apr-11 13:10pm
   
Start a new project/solution from scratch.
Member 7875079 at 27-Apr-11 15:34pm
   
That is not an option.
AspDotNetDev at 27-Apr-11 16:12pm
   
Sure it is. For testing purposes, at least. See if you can do that.

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

  Print Answers RSS
0 OriginalGriff 350
1 Jochen Arndt 190
2 Richard MacCutchan 135
3 Sergey Alexandrovich Kryukov 130
4 DamithSL 105
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,310


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 27 Apr 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100