I have a VB .net application which raises an 'Unhandled Exception' when running as an exe. In the IDE the correct top-level error message is shown.
I have recreated the problem -
In module1.vb -
Form1 has a single Button Control
Code in Form1.vb -
So, when the button is clicked, a message box should be displayed with the text 'FATAL ERROR in Application'. This works fine when running within the .Net IDE. However, when running the .exe - on the development PC or on another PC - a box is displayed saying that there was an unhandled exception. The exception which is unhandled is 'B1_Click error'.
Has anyone else seen this behaviour and how do I fix it?
I have recreated the problem -
In module1.vb -
Code:
Sub Main
Try
Application.Run(New Form1)
Catch ex As Exception
MessageBox.Show("FATAL ERROR in Application")
End Try
End Sub
Form1 has a single Button Control
Code in Form1.vb -
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Throw New Exception("Thrown Error!")
Catch ex As Exception
Throw New Exception("B1_Click error")
End Try
End Sub
So, when the button is clicked, a message box should be displayed with the text 'FATAL ERROR in Application'. This works fine when running within the .Net IDE. However, when running the .exe - on the development PC or on another PC - a box is displayed saying that there was an unhandled exception. The exception which is unhandled is 'B1_Click error'.
Has anyone else seen this behaviour and how do I fix it?