J
Jan Obrestad
Hello.
I'm developing an application using CF 1.0.
I found that exceptions in eventhandlers might end the program.
Let me give a short example:
I have two forms Form1 and Form2.
Form1 has a button which shows Form2:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim a As New Form2
Try
a.ShowDialog()
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
End Sub
On Form2 I have a button that throws an exception.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Throw (New Exception("Custom Exception"))
End Sub
When I click this button the messagebox appears, but then the program
just ends.
Is there any way of preventing the program from exiting? (Other than
putting try catch in all event-handlers)
I'm developing an application using CF 1.0.
I found that exceptions in eventhandlers might end the program.
Let me give a short example:
I have two forms Form1 and Form2.
Form1 has a button which shows Form2:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim a As New Form2
Try
a.ShowDialog()
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
End Sub
On Form2 I have a button that throws an exception.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Throw (New Exception("Custom Exception"))
End Sub
When I click this button the messagebox appears, but then the program
just ends.
Is there any way of preventing the program from exiting? (Other than
putting try catch in all event-handlers)