Click here to Skip to main content
15,902,114 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
public partial class EntryPass : Form
{
   public EntryPass()
   {
      InitializeComponent();
   }
   ActionForm af = new ActionForm();
   private void EntryPass_FormClosing(object sender, FormClosingEventArgs e)
   {
      bool cancel = true;
      if (MessageBox.Show("Do You Really Want to Quit?", "ExitWindow", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
      {
         cancel = false;
         af.Activate();
         af.Show();            
      }
   e.Cancel = cancel;
}


I want that, when I close EntryPass form then it Activate the ActionForm (since it is already open). So for this I code as above, but when I run this code, I am getting this exception
"stackoverflowexception" in the line:
C#
ActionForm af = new ActionForm();

Please help me...
Posted
Updated 26-Mar-12 4:26am
v4
Comments
Shahin Khorshidnia 26-Mar-12 10:20am    
No, this code doesn't cuase any exception.
I think the exception is because of another parth of the application.
woopsydoozy 26-Mar-12 14:49pm    
Looks OK--what's happening in the constructor/FormLoad of ActionForm?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900