0

I am doing class library project with vb.net to work with AutoCAD The problem is, Message box isn't working inside catch block but works fine anywhere in code. I tried the following lines and I got message box in try and default dialog box in catch

Try
 Windows.Forms.MessageBox.Show("Testing Started")
 Dim x, y, z As Integer
 x = y / z
Catch ex As Exception
 Windows.Forms.MessageBox.Show(ex.Message)
End Try
  • Ok .. I got it .. I changed to be: Catch ex As System.Exception – Mohamed Allam May 29 '14 at 11:06
  • You'll find there's often ambiguity with AutoCAD namespaces and other libraries. I'm guessing you had Autodesk.AutoCAD.Runtime imported up top right? – Parrish Husband May 29 '14 at 12:45
  • 1
    Autocad gives you access to an alert dialog. Application.Alert() I believe. It may be Document.Alert(). Document being your Document object. So if you're importing the forms namespAce just for the alert, it's really unnesseary. – Trae Moore May 29 '14 at 16:54
  • @Locke Your guess is right,I imported Autodesk.AutoCAD.Runtime – Mohamed Allam May 31 '14 at 12:17
  • @TraeMoore The application is more complicated than that. I am generating AutoCAD drawing based on Excel data. I have a lot of exceptions,so,I created database for errors and created error code for everyone. I am not using Windows.Forms.MessageBox anymore. I created my own form for error handling. Anyway, Thanks for concern. – Mohamed Allam May 31 '14 at 12:22
  • Cool, glad you got it worked out. Just incase anyone looks at this in the future; the member is, `Application.ShowAlertDialog(string message)` – Trae Moore Jun 02 '14 at 16:25

0 Answers0