By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,281 Members | 2,201 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,281 IT Pros & Developers. It's quick & easy.

Capture unhandled exceptions thrown by an MDI child form?

P: n/a
Hi All,

How can you capture unhandled exceptions thrown by an MDI child form separate from the entire app?

I have an application-wide exception handler to catch crashes by doing the following in my Application entry point:

Public Shared Sub Main()
'Explicitly set apartment state to Single Thread Apartment (STA)
System.Threading.Thread.CurrentThread.ApartmentSta te = System.Threading.ApartmentState.STA
Dim eh As New MyExceptionHandler()
AddHandler Application.ThreadException, AddressOf eh.OnThreadException
Application.Run(New Form1)
End Sub

The form that I'm using to handle this reports/logs the exception and closes down the application. This works perfectly. I now want to enhance this
functionality by catching unhandled exceptions within individual MDI Child forms so that I can close down just the child form and not the entire app.
I'm having trouble isolating the exceptions thrown by the child forms separately. Does anyone have any tips on how best to do this?


Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.