Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have MDI and Child Forms. My MDI_FormClosing event contains the following code:
C#
clsMain.CN.Close(); //"CN" is my SqlConnection object
clsMain.CN.Dispose();
Environment.Exit(-1);


When I closed the MDI form with no opened child forms, it was working well.
When I try to close MDI and there is a child form is opened, the following exception is thrown.

http://www.mediafire.com/conv/e039f1817d1719f47d55f3a1270ebad95741c775c40d4c36c500422dab7c09d86g.jpg

CSS
Problem signature:
  Problem Event Name:   APPCRASH
  Application Name: General Accounts.vshost.exe
  Application Version:  10.0.30319.1
  Application Timestamp:    4ba2084b
  Fault Module Name:    ntdll.dll
  Fault Module Version: 6.1.7600.16385
  Fault Module Timestamp:   4a5bdadb
  Exception Code:   c0000005
  Exception Offset: 00024b7d
  OS Version:   6.1.7600.2.0.0.256.1
  Locale ID:    3073
  Additional Information 1: e8ad
  Additional Information 2: e8adce1c2b9e7be834b4063ac3c53863
  Additional Information 3: e8ad
  Additional Information 4: e8adce1c2b9e7be834b4063ac3c53863

Read our privacy statement online:
  http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

If the online privacy statement is not available, please read our privacy statement offline:
  C:\Windows\system32\en-US\erofflps.txt


I tried to go to Project Properties, Debug tab and remove the check from "Enable the visual studio hosting process" .. it is still not working.

How can I avoid this message or this error ??
Posted

1 solution

 
Share this answer
 
v3
Comments
Ahmad Negm 17-Jul-12 9:37am    
I tried to go to Project Properties, Debug tab and remove the check from "Enable the visual studio hosting process" .. it is still not working.
Prasad_Kulkarni 17-Jul-12 10:03am    
Links formatted.

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