I am working on a VB.Net application and am having trouble getting a grasp on
the new way to open and close forms. I understand the object-oriented
approach of .NET, but not fully. I will explain the situation, and if anyone
can point me to any good examples or articles I would appreciate it.
The application starts with a simple "frmLogin" form which asks for the
username/password. Upon entering the correct password, I would like the user
to close this form, and open the "frmMain" form which is the Main form in the
application. What is the best approach to do this?
I had this code:
Dim frm as New frmMain()
frmMain.Show()
Me.Hide()
However, this leaves the "frmLogin" form still open. Is there a way to
close, or get rid of the frmLogin after the user successfully logs in?
Thanks for any help!!
Herfried K. Wagner [MVP] - 16 Dec 2004 07:04 GMT
"Davy C" <Davy C@discussions.microsoft.com> schrieb:
> Dim frm as New frmMain()
> frmMain.Show()
> Me.Hide()
>
> However, this leaves the "frmLogin" form still open. Is there a way to
> close, or get rid of the frmLogin after the user successfully logs in?
See:
<URL:http://www.google.de/groups?selm=u%23xQOutWDHA.2100%40TK2MSFTNGP11.phx.gbl>

Signature
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/
Ed Kaim - 16 Dec 2004 07:05 GMT
There are a lot of ways to do this. Perhaps the easiest way is to make the
main form the default form, and set it to not be visible by default. In it's
Load event handler, show the login screen. If the user successfully logs in,
close the login form and make the main form visible.
>I am working on a VB.Net application and am having trouble getting a grasp
>on
[quoted text clipped - 16 lines]
> close, or get rid of the frmLogin after the user successfully logs in?
> Thanks for any help!!
Davy C - 16 Dec 2004 14:53 GMT
How do I make the Main Form invisible? I tried calling "Me.Visible = False"
in the Load event, but I guess this is incorrect. Where do I place that
call? Thanks!
> There are a lot of ways to do this. Perhaps the easiest way is to make the
> main form the default form, and set it to not be visible by default. In it's
[quoted text clipped - 21 lines]
> > close, or get rid of the frmLogin after the user successfully logs in?
> > Thanks for any help!!
Ed Kaim - 18 Dec 2004 00:46 GMT
Try setting it in the contructor (the New() method in VB) before the
InitializeComponent call.
> How do I make the Main Form invisible? I tried calling "Me.Visible =
> False"
[quoted text clipped - 32 lines]
>> > close, or get rid of the frmLogin after the user successfully logs in?
>> > Thanks for any help!!