How to make a splash form

Night

Newcomer
Joined
Apr 24, 2003
Messages
13
Location
Ha Noi - Viet Nam
Make splash form may sound easy but its not.
I need a loading form that can:
- Display on screen as a modal form to prevent user from interacting with UI when the program is busy (load something - it take time)
- When display that form, we're still able to run loading code
- That form can be close any time
- May be in the future: display progress bar on the loading form

I've tried some thread things and also meet a lot of thread bugs ;)
 
This is how I make my Splash form work

Set the startup form of your solution to be your splash form.

Set a timer on your splash form to the desired delay

Have this code on the splash form timertick event

Replace frmMain with the name of your main application form

Visual Basic:
Private Sub tmrSplash_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrSplash.Tick

Dim frmNewMain As New frmMain()

Me.tmrSplash.Enabled = False

Me.Hide()

frmNewMain.Show()

End Sub

some say don't use a timer, but I have always done it this way and have never come across any problems as yet in doing so
 
The reason people will recommend against a timer is it will usually cause the splash screen to be displayed for either too long or not long enough, both of which we want to avoid. The general procedure you should be using would be:

Code:
Show splash form
Load program objects
Hide splash form

To add a progressbar, you would update it after each individual program item has been successfully initialised.
 
Point taken, but I've never experienced the situation you mention, each to his own I suppose?
 
I guess there is no problem using a timer in a splash screen, cause some times we want to display it for a determinated amount of time, so the user can read whats written. I would use the Squirm methods to show status forms.
 
Back
Top