M
Myron Marston
First off, I want to say a big thank you to all the guys that created
the OpenNET SDF--even though I'm not using the entire library directly
in my app, I've found much of it to be extremely useful and helpful,
and I'm using several bits of source code in my project directly.
Recently, I've started using ApplicationEx and the IMessageFilter
interface so that I can prefilter windows messages (which works
wonderfully, by the way!). The problem I am running in to is the use
of ApplicationEx.ShowDialog(). This method disposes of the dialog form
when it's done with it. However, I don't want it to do this--I keep a
reference to my dialog around and show it again when the user clicks
the button again (besides, as I understand it, Form.ShowDialog() on
both the desktop and compact framework doesn't dispose the form). I
added a boolean flag parameter to ApplicationEx.ShowDialog so that I
could prevent it from disposing the form. However, when the user hits
the button and I call ApplicationEx.ShowDialog again, I get an
ObjectDisposedException. Specifically, this happens on Form.Show(). I
put a breakpoint in my dialog form's Dispose method, but it is never
being reached.
What could be causing the ObjectDisposedException when my form's
dispose is never being called? Is it possible to change
ApplicationEx.ShowDialog to allow it to be called multiple times on the
same form?
Thanks!
the OpenNET SDF--even though I'm not using the entire library directly
in my app, I've found much of it to be extremely useful and helpful,
and I'm using several bits of source code in my project directly.
Recently, I've started using ApplicationEx and the IMessageFilter
interface so that I can prefilter windows messages (which works
wonderfully, by the way!). The problem I am running in to is the use
of ApplicationEx.ShowDialog(). This method disposes of the dialog form
when it's done with it. However, I don't want it to do this--I keep a
reference to my dialog around and show it again when the user clicks
the button again (besides, as I understand it, Form.ShowDialog() on
both the desktop and compact framework doesn't dispose the form). I
added a boolean flag parameter to ApplicationEx.ShowDialog so that I
could prevent it from disposing the form. However, when the user hits
the button and I call ApplicationEx.ShowDialog again, I get an
ObjectDisposedException. Specifically, this happens on Form.Show(). I
put a breakpoint in my dialog form's Dispose method, but it is never
being reached.
What could be causing the ObjectDisposedException when my form's
dispose is never being called? Is it possible to change
ApplicationEx.ShowDialog to allow it to be called multiple times on the
same form?
Thanks!