how can i control the splash screen display duration?

ethicalhacker

Well-known member
Joined
Apr 22, 2007
Messages
142
Location
Delhi,India
Programming Experience
5-10
my application opens pretty quick but just for looks I put the splash screen and loading has slowed down. can i decrease the normal time for which the splash screen is shown?
 
Splash screen duration

For me, current splash screen duration is too short at 2 sec. I found above mentioned link as well. But when I copy/paste following to ApplicationEvents.vb:
Public Class MyApplication

Protected Overrides Function OnInitialize( _
ByVal commandLineArgs As _
System.Collections.ObjectModel.ReadOnlyCollection(Of String) _
) As Boolean
' Set the display time to 5000 milliseconds (5 seconds).
Me.MinimumSplashScreenDisplayTime = 5000
Return MyBase.OnInitialize(commandLineArgs)
End Function
End Class

And I get these errors:
Error 1 function 'OnInitialize' cannot be declared 'Overrides' because it does not override a function in a base class.

Error 2 'MinimumSplashScreenDisplayTime' is not a member of 'WindowsApplication1.MyApplication'.

Error 3 'OnInitialize' is not a member of 'Object'.

Could anyone help me?
Thanks!

-Ben-
 
The ApplicationEvents.vb file that IDE generates doesn't look like that, it's by default 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

End Class

End Namespace
Within the MyApplication class you can paste the OnInitialize method from the help page.

If you accidentally corrupted the ApplicationEvents.vb file you can delete it from project in Solution Explorer, then go to project properties and click the "Application Events" button again to have a new one generated.
 
Try adding :
VB.NET:
My.Application.MinimumSplashScreenDisplayTime = 5000

Right after this line:
VB.NET:
Private Sub splash_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
in the source of the splash screen.

This is how I control mine.
 
The ApplicationEvents.vb file that IDE generates doesn't look like that, it's by default this:
Within the MyApplication class you can paste the OnInitialize method from the help page.
Hi John,
SplashScreen works alright but there is an issue that MDI from appears after one second while SplashScreen is still appearing its for 5 seconds. Can you help me about that?
 
Hi John,
SplashScreen works alright but there is an issue that MDI from appears after one second while SplashScreen is still appearing its for 5 seconds. Can you help me about that?

Whichever form you choose as the Splash Screen in the project properties will be displayed first. That form will be displayed for at least 2 seconds by default and as long as the startup form is not ready to display. Whichever form you choose as the Startup Form in the project properties will be displayed when the splash screen is dismissed and not before. If your current project doesn't work that way then either you're doing something wrong or something is corrupt on your system. Try out a new project with just two forms and see if it works correctly.
 
Normally it works well for default time but I want to increase the time for an exact moment which I want to decide but then the issue starts at that point that I don't want to face with it. So, I found a way to extend the time but then my mainform which is MDI parent start after default time accomplished and the mainForm come up. Anyway, I found another way to do a splash screen but then causes another issue I think mainForm(parent) as set property and "When last form closes" property interferes this situation because If I choose that splash screen as startup form then things work well until closing of mainForm(parent) because I should use hide function for hiding the splash screen after 4000 time tick accomplished and then show the mainForm. Maybe you will say that why I dont set the property of splash screen as used current one in my project. But then as I said it comes up for 2 seconds then its not satisfactory for me to show or use it and this discussion has already started with this issue actually.
 
I just made a new project for this matter for testing but I am afraid of saying that something come into conflict with MDIParent form's properties which are used to make in that new project.
First thing that is Splash Screen come up with MDIParent form at the same time and this is totally fail for this aim. I made everything normal and its really totally simple one after I made it several times. By the way, I never attempted to extend more time to display with Splash Screen.
Startup Form: Form1
Shutdown mode: When last form closes
Splash Screen: SplashScreen1 (in VS 2012 form option)

and a couple properties of Form1, IsMDIContainer (TRUE)
WindowState : Maximized

Where is the wrong thing that made in that project? Things look alright, as much as I see.
 
Now I figured out that matter what is, so "WindowState : Maximized" causes that issue. I could also attempted to extend the time for 5 seconds and done successfully. My solution will be making MDIParent form's size as 1024;768 and WindowsState : Normal then I wont be faced an issue like before :) Sorry for inconvenience
 
Back
Top