> The reason why I am asking is that I am creating a program and I need a
Splash-screen (like the tiny screen that appears when programs like Word
starts), and when the Splash-screen has been loaded for a couple of
seconds it should be unloaded (it is not for any use anymore)... how do I unload
just this form and not the entire project. Remember that this form (the
Splash-form) is the form that trigger triggers the next form and therefore
is the 'parent' to the entire project or something (I have been told that by
closing this form with the Close-command it'll close all the Child-forms)
The reason for your trouble is that in VB.NET, whatever your project calls
its "Startup Object" in the Project Properties dialog, is the thing that
provides the "Message Loop". Without a message loop, an application will
launch, appear briefly and then exit.
If your startup object is a form, that startup form holds the message loop.
When that form closes, the message loop ends and the application exits. You
have two solutions:
If you want your project to start from a form, set your main form to be the
startup object, and use the load event of your main form to show the splash
screen. (Don't forget to set the TopMost property of the splash form on its
property window)
frmMain.vb:
Private Sub frmMain_Load(...)
'frmMain is set to be the project's startup object.
'frmMain owns the message loop.
frmSplash.Show()
End Sub
If you want your project to start from Sub Main, do this:
basGlobal.vb:
Module basGlobal
Public Sub Main()
'Here, there is no form that owns a message loop because
'the startup object is Sub Main(). The message loop is
'handled by Application.Run() and is associated with
'whatever form you create an instance of, and pass to it.
frmSplash.Show()
Application.Run(New frmMain()))
End Sub
End Module
--
Peace & happy computing,
Mike Labosh, MCSD MCT
Owner, vbSensei.Com
"Escriba coda ergo sum." -- vbSensei