Login Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I need to open a login form when an applicaton starts (MDI form)
How can i trap the moment when MDI parent form is on

Thanks
Mark
 
Mark

Use the 'Activated' event on the MDI form. As the activated event is triggered each time the form is activated, you will need to use a flag so that the login form only appears the first time the form is activated (i.e. just after it is loaded)..

\\Private mblnLoginAlreadyProcessed As Boolea

Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activate
If Not mblnLoginAlreadyProcessed The
mblnLoginAlreadyProcessed = Tru

Dim objLoginForm As New frmLogi

objLoginForm.ShowDialog(
End I
End Su
//

(convert to C# as required

HTH
Gary
 
Gary's solution more accurately answers your direct
question, but I like to open the login form before
opening the Mdi parent. Hey, why should they see it if
they are not authenticated.

[STAThread]
static void Main()
{
if(Authenticate() == true)
{

MainForm frmMain = new MainForm();
Application.Run(frmMain);

}
}

In Authenticate() open your login form as a dialog an
pass back success or fail.

Todd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top