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 / November 2006

Tip: Looking for answers? Try searching our database.

Show loginwindow before MainWindow

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stephan Zaubzer - 30 Nov 2006 15:45 GMT
I have an application which uses a main window. But before showing the
Main Window (which is best done by Application.Run(new MainWindow();) I
need to show a Login Window. When the login fails, the application
should terminate but when the login is successful the loginwindow should
be destroyed and the main application window should be presented to the
user.

What is the best way to do it?
-Can I call loginwindow.Showdialog() before calling Application.Run(new
MainWindow()
-Or should I create and show the loginwindow, then call
Application.Run() without a form as parameter and within the loginwindow
either call application.exit() or instantiate the MainWindow and upon
closing the mainwindow call application.exit().
Regards
Stephan
Kevin Spencer - 30 Nov 2006 16:08 GMT
The easiest way is to call the loginWindow.ShowDialog() method in the OnLoad
method of your form. The form will not appear until the OnLoad method
completes, and it can check the DialogResult of the method execution to
determine whether or not to close.

Signature

HTH,

Kevin Spencer
Microsoft MVP
Logostician
http://unclechutney.blogspot.com

Parabola is a mate of plane.

>I have an application which uses a main window. But before showing the Main
>Window (which is best done by Application.Run(new MainWindow();) I need to
[quoted text clipped - 11 lines]
> Regards
> Stephan

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.