By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,928 Members | 1,810 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,928 IT Pros & Developers. It's quick & easy.

easy (??) question: Open New Form and Close Current Form

P: n/a
Hi,

I want a Login-form that, once the username and password are validated,
opens a new Form (of the 'main'-application), and closes itself.

I tryed it like this: putting the following code in the click-event of the
login-button of my Login-form:
Dim frmAG As New frmAgent
frmAG.Show()
Me.Close()

Thios opens the new form (frmAgent), but at the "Me.Close" it not only
closes my login-form, but also the new openend frmAgent!

Does anybody knows how I'm able to open the frmAgent and close the
login-form? I guess this msut be very easy but I'm not abvle to find it :-/

Thanks a lot!

Pieter


Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"DraguVaso" <pi**********@hotmail.com> schrieb
Hi,

I want a Login-form that, once the username and password are
validated, opens a new Form (of the 'main'-application), and closes
itself.

I tryed it like this: putting the following code in the click-event
of the login-button of my Login-form:
Dim frmAG As New frmAgent
frmAG.Show()
Me.Close()

Thios opens the new form (frmAgent), but at the "Me.Close" it not
only closes my login-form, but also the new openend frmAgent!

Does anybody knows how I'm able to open the frmAgent and close the
login-form? I guess this msut be very easy but I'm not abvle to find
it :-/


sub main
dim login as new loginform
if login.showdialog = ok then
application.run(new frmAgent)
end if
end sub

Put the sub in a module and set it as the startup object. Or put it in a
class and add "shared" in front of the "sub" keyword.

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2

P: n/a
Hi Pieter,

Why not the normal way where a main form shows a new dialogform and goes on
when that closes with an OK or closes the application when it is Cancel?

Cor
Nov 20 '05 #3

P: n/a
I believe that the TaskVision application does something similar at startup.
You may want to look at the source for this solution to see how it's
handled.
http://windowsforms.net/Default.aspx...dex=6&tabid=44

--
Tim Wilson
..Net Compact Framework MVP
{cf147fdf-893d-4a88-b258-22f68a3dbc6a}
"DraguVaso" <pi**********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,

I want a Login-form that, once the username and password are validated,
opens a new Form (of the 'main'-application), and closes itself.

I tryed it like this: putting the following code in the click-event of the
login-button of my Login-form:
Dim frmAG As New frmAgent
frmAG.Show()
Me.Close()

Thios opens the new form (frmAgent), but at the "Me.Close" it not only
closes my login-form, but also the new openend frmAgent!

Does anybody knows how I'm able to open the frmAgent and close the
login-form? I guess this msut be very easy but I'm not abvle to find it :-/
Thanks a lot!

Pieter

Nov 20 '05 #4

P: n/a
* "DraguVaso" <pi**********@hotmail.com> scripsit:
I want a Login-form that, once the username and password are validated,
opens a new Form (of the 'main'-application), and closes itself.


<URL:http://www.google.de/groups?selm=u%23xQOutWDHA.2100%40TK2MSFTNGP11.phx. gbl>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.