Hi,
I'm trying to close and dispose a form that is running in another
process, but I get the error message "A first chance exception of type
'System.ObjectDisposedException' occurred in system.windows.forms.dll",
"Additional information: Cannot access a disposed object named
"frmProgressWindow".".
Here's what I'm trying to do basically...
My main UI thread launches another thread in which I show a modal
Progress Window (form with a progress bar). When I'm done performing
certain actions, I want to close the progress window from my main
thread, so I call this code:
Private Sub CloseProgressWindow()
If _progressWindow Is Nothing Then Return
_progressWindow.Invoke(New CloseProgressWindowDelegate(AddressOf
_progressWindow.Close))
_progressWindow.Invoke(New DisposeProgressWindowDelegate(AddressOf
_progressWindow.Dispose))
End Sub
The exception occurs on the "End Sub" (!) line. See the screenshot at
http://www2.adonis.ca/disposeerror.png.
What am I doing wrong?
Thanks!
Carl