Click to See Complete Forum and Search --> : Two Forms problem


arshadjehan
November 22nd, 2004, 09:00 PM
I am trying to make an MDi app. First of all a login form comes in and asks for username and password, if correct loads the main MDI container form. But I want as soon as the main form is displayed, the login form should be unloaded,
I use, ( I am using sort of pseudocode)

if (password and username ) are correct THen
dim frmMain as new frmMDIFORM
frmMain.show
frmLogin.dispose
else
Write "Password is Incorrect"
end if

Note that frmLogin is my startup form. But when the pw/username are verified, frmLogin terminates the entire app. (doesn't show frmMDIMAIN form)
HELP :(

ambreesh
November 22nd, 2004, 09:12 PM
is this related to .NET?

arshadjehan
November 22nd, 2004, 09:23 PM
Ya! I am using Vb.Net

Zeb
November 22nd, 2004, 10:29 PM
It's because you are declaring the form as an object in the login form, so when the login form is unloaded, all it's resources are being freed by the garbage collector - including your instance frmMDIFORM.

maybe you want to set the frmMDIFORM as the startup form and display the login form modally from the main form so that frmMDIFORM doesn't continue until the login is successfull (or returns that execution needs to be stopped).

arshadjehan
November 24th, 2004, 08:03 PM
Thanks Zeb