Re: 'status' form and disposal problem
Peter Ritchie <[email protected]> Tue, 31 Jul 2007 10:16:23 -0400
| Newsgroups | gmane.comp.windows.devel.dotnet.cx |
|---|---|
| Message-ID | <LISTSERV%[email protected]> |
How could your _timePanel variable be disposing while the user double- clicks a status bar panel if the dispose of _timePanel was the result of user interaction? Do you mean _timePanel is disposed when the user double-clicks the status bar panel? If the time panel is an application-wide shared resource (i.e. a class member not an instance member) then you might want to override the time panel's closing event and just hide the panel instead of letting it close. Then, you could ensure you dispose that panel when the main window closes. Although, if it's dependant on the main window I would question why it's not an instance member instead of a class member. -- Peter On Tue, 31 Jul 2007 10:02:43 -0400, Peter Osucha <[email protected]> wrote: >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? =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com