dispose the login form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

The program i have has login form.

After a user has loged in, formX is loaded and i want to dispose all the
forms that where used before (login form).

so the result should be the same as when you use formX as your startup object.

I dont want:
- to hide or minimaze the login form.
- use showdialog.

Is this possible?
 
JT,

Normally all your not with showdialog showed forms are disposed
automaticly, at a time that it is for your system the best time.

Therefore it is managed code.

I am curious why you ask this?

Cor
 
Hello Cor,

the problem is the following, when i dispose my login form, the application
stops.
for example, if a user loges in and i use formX.show and than close the
login form. FormX will also be closed.

When i use FormX.ShowDialog, the login form will exist untill FormX is closed.

jt
 
jt said:
The program i have has login form.

After a user has loged in, formX is loaded and i want to dispose all the
forms that where used before (login form).

so the result should be the same as when you use formX as your startup object.

I dont want:
- to hide or minimaze the login form.
- use showdialog.

Is this possible?

I would suggest:

Have a Sub Main that is your startup object. This sub shows your login
form (modally), then if login fails, just Exit Sub and the app will
end; but if login is successful you can load up your formX then do

Application.Run(formXvariable)

which transfers the message loop to that instance of formX (which means
the application's lifetime from then on depends on formX rather than
Sub Main).
 
Cor,

Thank you for your support, but as a mentioned, i dont want to use the
showdialog.
Larry pointed me out the Application.Run(formXvariable) option and that did
the trick.

Thanks.
 
Larry, that was what i was looking for:

Application.Run(formXvariable)

Thanks
 

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

Back
Top