Home All Groups Group Topic Archive Search About

dispose the login form

Author
20 Jan 2006 9:13 AM
jt
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?

Author
20 Jan 2006 9:19 AM
Cor Ligthert [MVP]
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
Author
20 Jan 2006 9:34 AM
jt
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

Show quoteHide quote
"Cor Ligthert [MVP]" wrote:

> 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
>
>
>
Author
20 Jan 2006 9:40 AM
Cor Ligthert [MVP]
JT,

I would use the showdialog. Be aware that there are some bugs in the version
1.x when it is about the closing buttons of that.

If you need some samples, reply.

This newsgroup is full of that in the most advanced formats and the Google
Newsgroup search is the best for that.

This only the one I wrote about showdialog.

http://groups.google.com/group/microsoft.public.dotnet.languages.vb/search?group=microsoft.public.dotnet.languages.vb&q=showdialog+cor&qt_g=1&searchnow=Search+this+group

Cor
Author
20 Jan 2006 10:28 AM
jt
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.

Show quoteHide quote
"Cor Ligthert [MVP]" wrote:

> JT,
>
> I would use the showdialog. Be aware that there are some bugs in the version
> 1.x when it is about the closing buttons of that.
>
> If you need some samples, reply.
>
> This newsgroup is full of that in the most advanced formats and the Google
> Newsgroup search is the best for that.
>
> This only the one I wrote about showdialog.
>
> http://groups.google.com/group/microsoft.public.dotnet.languages.vb/search?group=microsoft.public.dotnet.languages.vb&q=showdialog+cor&qt_g=1&searchnow=Search+this+group
>
> Cor
>
>
>
Author
20 Jan 2006 9:43 AM
Larry Lard
jt wrote:
> 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).

--
Larry Lard
Replies to group please
Author
20 Jan 2006 10:28 AM
jt
Larry, that was what i was looking for:

Application.Run(formXvariable)

Thanks

Show quoteHide quote
"Larry Lard" wrote:

>
> jt wrote:
> > 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).
>
> --
> Larry Lard
> Replies to group please
>
>