microsoft.public.dotnet.languages.vb - Microsoft .NET technology
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!
Hi, I have the following problem, most probably a bug: I have a windows form that incorporates one Button control and one ToolTip control. On the form's Load event, I am setting the tooltip message of the button by calling the SetTooltip() method. On the button's Click event the form is disposed using the .Dispose() method. If the form is opened from another form using the .ShowDialog() method, if the button is pressed I get a NullReferenceException. Notes: 1. If the form is called using the .Show() method then the exception does not occur. 2. If the SetTooltip() method is not called then the exception does not occur. 3. If the .Close() method is used on the Click event, instead of the Dispose(), and the .Dispose method is called imediatelly after the .ShowDialog() method, the exception does not occur. 4. This problem did not occur on the .NET 1.1 Is this some kind of bug ? Thanks Emmanuel
I am fighting exhausted resources in a large application with many forms. It manifests itself by EVENTUALLY not being able to load an ImageList. In researching this I see advice in previous postings to call Dispose on a form when finished with the object, after a ShowDialog. It is suggested this is necessary to avoid GDI resource leaks. My question is, what about when you open the form non-modally with Show? Will the form do its own Dispose, or am I obligated to find a way for this to happen? If so, can someone suggest a strategy for managing this? - Lee
Hi I'm working on a program that will have 3 forms: a main form, a status form and a sub-form. The main form and status form are always appear, and my sub-form is a singleton (for performance issue). As usual, I have two ways to display the sub-form: Show() and ShowDialog(). When I use ShowDialog() (the main form calls it), the program works fine but I cannot access the main form and the status form (also called by the main form). Because I still want to have access to the other forms, I have to use Show() But my program will crash with Show() because unlike ShowDialog(), when the form that opened with Show() is closed, the form is also disposed. This is not what I wanted because it's a singleton and I want it to be disposed when the main form closed (the whole program terminates). I think I should override an event to suspent the Disposing but I can't find which event I should use, and how would I do it. Any help is welcome. Best Regards, Homa Wong