Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / December 2004

Tip: Looking for answers? Try searching our database.

Windows Forms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Davy C - 16 Dec 2004 04:47 GMT
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!!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.