G
Guest
All,
I'm getting this exception error when I attempt to exit out a Win Forms 2.0
application with the following sample code:
Private Sub RaythomConfiguration_FormClosing(ByVal sender As Object,
ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If MsgBox("Are You Sure You Want To Close?", MsgBoxStyle.YesNo) =
MsgBoxResult.Yes Then
Me.Dispose()
Else
e.Cancel = System.Windows.Forms.DialogResult.No
End If
End Sub
Private Sub btncancel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btncancel.Click
Me.Close()
End Sub
Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnexit.Click
Application.Exit()
End Sub
The eror message is as follows:
System.InvalidOperationException was unhandled
Message="Collection was modified; enumeration operation may not execute."
Source="mscorlib"
How do I exit out when i'm using the Form_Closing sub routine? Any help
would be greatly appreciated?
Thanks,
I'm getting this exception error when I attempt to exit out a Win Forms 2.0
application with the following sample code:
Private Sub RaythomConfiguration_FormClosing(ByVal sender As Object,
ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If MsgBox("Are You Sure You Want To Close?", MsgBoxStyle.YesNo) =
MsgBoxResult.Yes Then
Me.Dispose()
Else
e.Cancel = System.Windows.Forms.DialogResult.No
End If
End Sub
Private Sub btncancel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btncancel.Click
Me.Close()
End Sub
Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnexit.Click
Application.Exit()
End Sub
The eror message is as follows:
System.InvalidOperationException was unhandled
Message="Collection was modified; enumeration operation may not execute."
Source="mscorlib"
How do I exit out when i'm using the Form_Closing sub routine? Any help
would be greatly appreciated?
Thanks,