Carlo

Carlo

  • NA
  • 1
  • 14.5k

Issue Closing (X-ing out) a Windows Form

Nov 5 2010 3:37 PM

Anybody know what the following errors are (In Microsoft Visual Studio[MVS] they show up in the output tab in Debug mode)?
"A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.dll
A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in Test_Plan_Admin.dll"
I'm simply trying to X out a Windows Form, but it won't close at all and the window remains as if I didn't even click the X(close button) button and I get the above error. I've googled this and can't seem to figure out why exactly this is occurring. Just wondering specifically in anyone has seen this issue with X-ing out a Windows Form and/or the above error messages.
The code that I am working with is not my own, is a rather large project and this is the most indicative lines of code I can provide. This is where the exception occurs:
 private void Save_Window_State()
 {
    Properties.Settings.Default.WindowState = WindowState.ToString();
   if (Properties.Settings.Default.WindowState.Equals("Normal", StringComparison.OrdinalIgnoreCase))
   {
      Properties.Settings.Default.WindowHeight = Height;
      Properties.Settings.Default.WindowWidth = Width;
      Properties.Settings.Default.WindowXLoc = Left;
      Properties.Settings.Default.WindowYLoc = Top;
   }
   else
   {
      Properties.Settings.Default.WindowHeight = RestoreBounds.Height;
      Properties.Settings.Default.WindowWidth = RestoreBounds.Width;
      Properties.Settings.Default.WindowXLoc = RestoreBounds.X;
      Properties.Settings.Default.WindowYLoc = RestoreBounds.Y;
    }
    try
    {
      Properties.Settings.Default.Save();
    }
    catch (Exception e)
    {
      throw (e);
    }
}

This try line is where I get these errors in the MVS Outputs tab in Debug mode. This is the click event for the X button which I am under the assumption is default set-up when creating a Windows Form in MVS. Any thoughts would be awesome.
Thanks,
Carlo Caunca

Answers (1)