Splash Screen Close Makes Calling Form Disappear

Hello World:

I've got a Splash Screen built according to the expert advice given in the topic entitled "Splash Screen - How to?"

See:

http://www.experts-exchange.com/Programming/Programming_Languages/  _    
          Dot_Net/VB_DOT_NET/Q_21165686.html?query=Splash+screen&topics=866

My Splash Screen essentially works. However, when it comes time to close the splash form, both the splash form *and* the calling form disappear. To be more specific,  in Debug / Run mode, VB.NET replaces the calling form as the "top most" app and the calling form doesn't really disappear - but ends up being hidden under the VB.NET development environment.

More info...

The Splash Screen "how to" code, complete with a timer, is in my Main Form which according to the Properties of the Executable is defined as the starting point of the app. When Form_Load is called in my Main Form, the Class cThreadSplash is in turn called. cThreadSplash launches the Splash Screen and when the timer runs out, it raises a Timer_Elapsed event. The Splash Screen is then closed. But, in so doing the Main Form loses its Z-Order and seemingly disappears.

Does anyone know what is going on here? Why doesn't the Splash form just close leaving the Main Form in clear view?
gbmcneilAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

doobdaveCommented:
Hi there,

The reason for this may be because you are instantiating your splash form from your Main form.
Looking at the other post you link to, I think the above statment is correct.

I suggest you do the following:

> Create a Shared Sub Main(), either in your Main form, or in a separate class file (in the same project)

> Set your startup object to be Sub Main() (in project properties)

> Instantiate your splash form from that sub (instead of the Main form), and when the splash form returns, create and show the Main form.

Hopethis works for you, let me know if you need further explanation.

Regards,

David

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gbmcneilAuthor Commented:
Hi Dave:

Thanks for your input. A unexplainable thing happened: I continued to work on my Splash dialog (from a graphical standpoint) and then added a new form which is part of my application. I may have re-booted along the way.

Mysteriously the Splash Form now works as intended. The Main Form appears, followed by the Splash, followed by the Splash closing - with only the Main Form remaining. As I said before, the Main Form had been "disappearing" by hiding under VB.NET when the Splash terminated.

Frankly, I'm bewildered by the whole thing. This makes me think there is some kind of Z-order to the forms themselves - at least while in a development mode.

As for your suggestion, I will experiment. But, I think your approach would create a different effect. One where the Splash Screen would appear by itself, following by the Main Form by itself. That is not what I want to do.

That is why I have launched the Splash dialog from the Main Form. And even from here, on some occasions when I was initally trying to get the thing to work any way it would, the Splash would appear by itself and the Main Form would never appear.

Is it possible to launch the Main Form from Sub Main(), and after it has been launched have it return so that the Splash Form can be launched?

Maybe it isn't worth monkeying with so long as it continues to work at present. But, it would be nice to know what exactly is going on.
doobdaveCommented:
That's strange, I'm not sure what happened there!

It's certainly possible to fire up the main form from sub main, and then load the splash form while the main form is initialising.
I would do this by creating a new thread which starts the main form, that way control is immediately returned to your sub main, where you can frie up the splash form.
However, as you say, if it's now working as you want it, it may be best to let sleeping dogs lie!

Regards,

David
gbmcneilAuthor Commented:
Hello DoobDave -

Sorry for the delay. Since you were the only fellow who bothered to reply, you get the prize. Thanks for your help.

As for the splash screen, it seems that the greater issue is that when my VB.NET is launched for the first time, the delay is long bringing Net Framework's files into memory that the screen appears for one tenth the time it would on subsequent launches. I will submit this as a new question shortly.

Gordy
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.