|
-
Apr 14th, 2004, 06:55 AM
#1
[Resolved]Global Try...Catch with dynamic controls...
Currently, to trap untrapped exceptions, I have this...
VB Code:
Public Shared Sub Main()
Try
Application.Run(New frmMain)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
It works fine for the most part, except that a many controls that I have in my app will be loaded dynamically via the Activator.CreateInstanceFrom() method. I put in a couple of Throw's in one of my dynamic controls, just to test it out, but the exceptions don't even seem to be getting thrown, let alone caught by my Try Catch block. What have I missed?
Last edited by crptcblade; Apr 14th, 2004 at 09:36 AM.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Apr 14th, 2004, 07:05 AM
#2
Well, it seems that the not throwing exceptions problem is due to the fact that the dynamic control is a project that was converted from VB6. Once I added a native .NET control and threw an exception from there, the exception was actually thrown.
However, the global Try...Catch does not handle this exception. Is there a way for me to have it catch the unhandled exceptions without having a reference to the control project from my main exe project?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Apr 14th, 2004, 09:36 AM
#3
Found it. The solution is to add a ThreadException event handler to the Application object.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|