Desperately trying to stop excution

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

Guest

I am desperately trying to end the application but nothing seems to work in
following code, language = Langu.... is always executed.
The app starts with an Application.Run(new FrmMain());
Help!

public FrmMain()
{
InitializeComponent();
if (CredentialCache.Credentials.MySession == null)
{
FrmLogin loginForm = new FrmLogin();
loginForm.ShowDialog();
}
if (CredentialCache.Credentials.MySession == null) {NotLoggedEvent(this,
null);}
language = LanguageTable.GetTable (1, 999,
CredentialCache.Credentials.MySession, 1);
InitializeMenu();
timer1_Tick (null, null);
}

private event EventHandler NotLoggedEvent;

private void FrmMain_NotLoggedEvent (object sender, EventArgs e)
{
this.Close();
Application.Exit();
}
 
You might want to sign up for the event you created.

Add the line:

NotLoggedEvent += new EventHandler(FrmMain_NotLoggedEvent);

to your FrmMain constructor and try.

-vj
 

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