'status' form and disposal problem

Peter Osucha <[email protected]> Tue, 31 Jul 2007 10:02:43 -0400
Newsgroups gmane.comp.windows.devel.dotnet.cx
Message-ID <[email protected]>
I am showing a small form 'TimePanel' (which is a FixedToolWindow) as a
TopMost window in response to a double-click on a status bar panel of my
main app form (MainAppForm).  The form containing the status bar holds a
class level variable '_timePanel' referencing the TimePanel form.

In the constructor for MainAppForm, I instantiate the _timePanel object
- but I don't show it.  If the user double clicks on the appropriate
status bar panel, I check to make sure the _timePanel reference isn't
null and then I call _timePanel.Show() to show the form.

The problem... if the user closes the _timePanel form, and then double
clicks on the status bar panel, an error can occur because the
_timePanel variable is being disposed.

How should I be creating this functionality so that this error doesn't
occur?

Peter

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
This list is hosted by DevelopMentor=AE  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com