Need a help on MDI forms

sameera

Member
Joined
Jun 16, 2005
Messages
20
Programming Experience
Beginner
Hi, I have an query to solve,:D

I have coded a loging form to my project and after loging Succeeds it should show my main form(Which is mdi form). my loging form code is simmiler to this

ex- my main form is "frmMain" and login form is "frmLogin"

if login succeeds ,

dim mfrm as new frmMain
mfrm.MdiParent=me
mfrm.show
frmlogin.close

But with this code my mdi form is also closing.

can anyone help me to load my mdi form (" frmMain") and close my loging form after clicking the login button :eek:

a little code segment would do (So that i can get a clear idea)

regards,

sameera:)
 
If your login form is the startup object for your project then closing it will close the whole application. You should probably set the main form as the startup object and then display the login form from the Load event handler. Then, if login fails just close the main form. If login succeeds continue and open the child form.
 
Yeah what i got ur code , it is having a module to run as a startup as we often do when we need to validate the users. and then we do move to our main form. but if u look at sameera's code it is bit confusing and thats what i m worrying
he says "if login succeeds" that mean either he is in Login form or some other form which is launching the login procedure. Let suppose say u suggest that it is not login form. suppose it is another form i.e myMDIForm (hence MdiForm should be the startup form) now the sitution becomes like this
MdiForm launches LoginForm and then creates the instance of new form and then makes it to the child of existing form i.e. MdiForm and then closes LoginForm so as per i think it should never gona to close this way
so the problem is that we are misunderstaning sequence of operations (flow ) and as i hope this code will not be of sameera as it seems working ok (and it should be becuase it is not doing what he is facing)
 
Well, i agree with you ... you gave a some good points here ... but if he/she wants to prompt user for pwd and ID it's the same story except now in Login form should be added query to check if username and pwd are valid. Sameera, feel free to ask for more help if you need (about how to check validity of ID and PWD) ... would be glad to help you

Cheers ;)
 
Back
Top