Link to home
Start Free TrialLog in
Avatar of WinMasterXP
WinMasterXP

asked on

Unload Main Form, load another....

Hello all,
I am writing a multi-form application in VB.net that has multiple forms. I start with a Sub-Main that loads the splash and then the first form (Login.vb) After I have verified a user's login credentials, I wish to unload Login.vb from memory and load another form (Start.vb). I realize that I could just "hide" the form, however, it is kinda complex and uses a fair amount of system resources, and I am trying my best to make it as "system friendly" as possible.

In VB6 it used to be like this:
Load FORM
FORM.Show
Unload Me

In .NET I have tried the following:
Me.Close
Form.Close
Me.Dispose
Form.Dispose
Close() - Which is supposed to close the form?

However, because Login.vb is the main form and Start.vb isn't, all of the above close Start.vb as well cause it is not the parent form.

I also, tried to run the Start.vb after Login.vb closes in the Sub Main, but no luck.
So can anyone tell me how to do this?
Thanks,
Luke

P.S. Would it be possible to hide it, then have the GC pick it up without losing the open forms?
Avatar of HasnainC
HasnainC

Why don't you have a make a begin.vb which loads the splash screen and loads login.vb. After successful authentication, dispose login.vb and load start.vb.

That way all your resources will be disposed off when login.vb is disposed.
ASKER CERTIFIED SOLUTION
Avatar of HasnainC
HasnainC

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of WinMasterXP

ASKER

Thanks HasnainC,
This is what I was missing. If you still have the project files for what you have posted, I would appriciate it if you would just Zip it up and e-mail it to me at WinMasterXP@hotmail.com
Thanks,
Luke