Splash screens / loading & unloading forms

E

Eric A. Johnson

In a new project I'm creating, I have my first form that loads being used as
a splash screen, with a timer that activates after 5 seconds. I then want
the main form to load. However, it isn't allowing me to use frmMain.Load().
What can I use to load the main form, then unload the splash screen? Or
should I, perhaps, load an invisible control form that first loads the
splash screen, waits five seconds, then unloads it and loads the main form?
This might be a nice idea, since I may want to have other forms load and
unload... how can I get forms to be loaded and unloaded at will from an
invisible master form, say, frmControl? Thanks in advance for any
suggestions!

-- Eric
 
P

Peter W Johnson

Eric,

This is what I do:-

Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load



Me.Hide()

Dim splash As frmSplash

splash = New frmSplash

splash.Show()

splash.Update()

Thread.Sleep(2500)

splash.Close()

Me.Visible = True



End Sub

Cheers


Peter
 
C

Cor Ligthert [MVP]

Eric,

There are probably thousand of ways to make a splash screen.

However the last thing you have to do is know to use the right instructions.
"Form.Load" is an event that fires as soon as a form start loading and will
not start showing a form. You get the instructions for that when you click
on your form.

Therefore I think it is better for you to just create your program and know
how that goes and than afterwards add a splash screen, something that is if
your program is OOP seldom a problem.

Just my thought,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top