Re: 'status' form and disposal problem

"Fellows, William B." <[email protected]> Tue, 31 Jul 2007 10:30:18 -0400
Newsgroups gmane.comp.windows.devel.dotnet.cx
Message-ID <973411582584714AB0D1B4876826229D388C34@xmbv3801>
You might want to simply hide the controlBox in the upper right of the
form and just add your own 'close' button that hides the form again
instead of disposing of it. Then, when the status bar is doulble-clicked
the next time the form is availble to re-appear.=20


Bill Fellows
240-456-4859
[email protected]


-----Original Message-----
From: Discussion relating to the specifics of the C# and Managed C++
languages [mailto:[email protected]] On Behalf Of Peter
Osucha
Sent: Tuesday, July 31, 2007 10:03 AM
To: [email protected]
Subject: [DOTNET-CX] 'status' form and disposal problem

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(r)  http://www.develop.com

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

=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