closing a windows form

  • Thread starter Thread starter bill
  • Start date Start date
B

bill

Vb.net
I have 2 windows forms
One is used as the splash screen
I have the timer set to 5000
and enabled

I want the first screen to close and open a second form
the splash screen closes and then the second form never
opens.

Under the tick event

me.close()
dim form1 as new form1
form1.show


Why doesnt this work


Thanks
 
me.Close() unloads the resources of the form, and probably stops code
execution; if not - it would unload the newly created object because its
"owner" or "parent" is unloaded.

A better design would probably be to open the splash screen modal in the
"main()" function, then after that closes, open the "real" main window;

In the "Main()" -function (located in the "real" application form):
....

Dim frmMain as new Form1
Dim frmSplash as new SplashScreen ' Includes a message and a timer that
makes it close it self

frmSplash.ShowDialog(frmMain)

Application.Run(frmMain)

Regards,
Harald Bjorøy
 
Back
Top