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

  • Thread starter Thread starter DraguVaso
  • Start date Start date
D

DraguVaso

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
 
DraguVaso said:
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
 
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
 
Back
Top