I am having a small issue, well its not small, its probably a total PITA! I re-coded a windows based form, and when I try and close the form i get the error
"An unhandled exception of type 'System.StackOverflowException' occurred in System.Windows.Forms.dll"
The debug points me at the last line of this code. Can anyone show me how to either elegantly handle this or trouble shoot it?
"An unhandled exception of type 'System.StackOverflowException' occurred in System.Windows.Forms.dll"
The debug points me at the last line of this code. Can anyone show me how to either elegantly handle this or trouble shoot it?
VB.NET:
Private Sub frmGetUserInput_FormClosing(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Dim cancel As Boolean = eventArgs.Cancel
Dim unloadMode As System.Windows.Forms.CloseReason = eventArgs.CloseReason
If ((unloadMode = 0) And CurrentlyWorking) Then ' user tried to cancel process by closing the progress window (upper right "X")
lblThisReportStatus.Text = "Cancelling..."
worker.cancel = True
cancel = 1 ' prevent from closing right now (give time for process to be canceled properly)
Else
If (Not worker Is Nothing) Then
worker.Close() ' the program does not terminate until the child form is unloaded
End If
Me.Close()
End If
eventArgs.Cancel = cancel
End Sub