PC Review


Reply
Thread Tools Rate Thread

How to create a log in window?

 
 
Andy Pollak
Guest
Posts: n/a
 
      5th Aug 2003
Hi!

I want to create a small log in window for my application,
the same way Windows 2000 or similar programs do. It
should show immediately after the main form has been
loaded and displayed, i.e. the main form and the (modal)
log in form should be visible at the same time.

The problem is: How and where can I load the (modal) log
in form?

Using the Activated, Load, and Enter events of the main
form did not help, because the are called before (!) the
main form is displayed on the screen. Overriding WndProc
to catch the WM_SHOWWINDOW message produced the same
result.

Any idea would be greatly appreciated.

Many thanks in advance!

Best regards

Andy
 
Reply With Quote
 
 
 
 
Brett Morien
Guest
Posts: n/a
 
      5th Aug 2003
An extension to that, which I use, is to make the
mainForm come up conditionally only if the login passes.
If they don't log in, the form never even gets
instantiated. It's nice to have that one windowless class
that starts up. Much more options.

<code>

protected frmMain m_mainForm;
[STAThread]
public static void Main()
{
frmLogin loginForm = new frmLogin();

// Do all your login processing in the login dialog
DialogResult dlgRes = frmLogin.ShowDialog();

if (dlgRes != DialogResult.OK)
return;

m_mainForm = new frmMain();
m_mainForm.Show();
}

</code>

>-----Original Message-----
>If the "Main" method is in your main form, try moving to
>a separate class. Then you'll have a little more

control
>when things get displayed.
>
>In C# your code might look like this:
>
>public static void Main()
>{
> frmMain mainForm = new frmMain();
> frmLogin loginForm = new frmLogin();
>
> frmMain.Show();
> frmLogin.ShowDialog(frmMain); // frmMain = owner form
>}
>
>Hope that helps,
>T.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I create a new pop-up window =?Utf-8?B?TWlrZQ==?= Microsoft Frontpage 3 19th Jan 2006 10:14 PM
Create an About window =?Utf-8?B?R3JhbmRwYUI=?= Microsoft VB .NET 2 23rd Oct 2005 02:46 PM
Can you create window tabs within MS Access window? =?Utf-8?B?U2Vhbg==?= Microsoft Access 0 22nd Jun 2005 08:12 PM
Forms in Modal IE Window create a new window on postback! =?Utf-8?B?TmljayBQb3VsaXM=?= Microsoft ASP .NET 5 3rd Jun 2005 03:46 PM
How to use an asp:button to create a new browser window and output contents to new window =?Utf-8?B?Tm92aWNl?= Microsoft ASP .NET 2 9th Jun 2004 11:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:27 AM.