.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unhandled Exception

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
192 Views, 2 Replies

Unhandled Exception

When I run the following code when the form (FNonModal) has been disposed
of, the exception never gets caught by the program.
It remains unhandled and I'm being returned to the IDE. When I select
continue, AutoCAD catches the unhandled exception and displays an error
message (saying FNonModal has been disposed of)

Try
Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog(FNonModal)

Catch ex As Exception

MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)

End Try

Thanks in advance.
Guido Rooms
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

When I run the following code when the form (FNonModal) has been disposed
of, the exception never gets caught by the program.
It remains unhandled and I'm being returned to the IDE. When I select
continue, AutoCAD catches the unhandled exception and displays an error
message (saying FNonModal has been disposed of)

Additional information:
The problem also occurs when running AutoCAD from the start menu.
The error dialog I get in from AutoCAD informs me that "Application does not
support Windows forms just in time debugging"


Try
Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog(FNonModal)

Catch ex As Exception

MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)

End Try

Thanks in advance.
Guido Rooms
Message 3 of 3
Anonymous
in reply to: Anonymous

Sorry to have bothered you.
Been stupid. Should have given it some more thought...

Anyway,here's the solution:
I should have used "Catch ex as System.Exception".

Try
Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog(FNonModal)
Catch ex As System.Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
End Try

Thank me,
Guido Rooms

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost