closing a windows form

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
 
H

Harald Bjorøy

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
 

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