Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Compact Framework / January 2006

Tip: Looking for answers? Try searching our database.

Form.Dispose does not invoke InputPanel.Dispose

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tomj@softhome.net - 23 Jan 2006 10:55 GMT
I use CompactFramework 2.0.

The code generated by Designer does not invoke
InputPanel.Dispose when form is disposing. And
I cannot understand how it can work without
manual fixing.

Example:

     using (Form2 form = new Form2())
     {
       form.ShowDialog();
     }
     // Form2 instance is disposed, but inputPanel1 is not

Now if I show or hide SIP in other forms, Form2.inputPanel1
will also get event EnabledChanged and it will lead to an error(
because the form it belongs is already disposed)

   private void inputPanel1_EnabledChanged(object sender, EventArgs e)
   {
     //this code throw exception because form instance is disposed
     this.Text = "Form2 " + inputPanel1.Enabled.ToString();
   }

So, to fix the problem I need manually fix Designer code

   protected override void Dispose(bool disposing)
   {
     // Bug fix
     if (disposing)
     {
       inputPanel1.Dispose();
     }

     if (disposing && (components != null))
     {
       components.Dispose();
     }
     base.Dispose(disposing);
   }

Is it a bug?
   
Thanks,
Tom.
<ctacke/> - 23 Jan 2006 12:08 GMT
You're certain Form2 is getting disposed?  A Form shown with ShowDialog does
not get disposed when closed - that's by design.

-Chris

>I use CompactFramework 2.0.
>
[quoted text clipped - 42 lines]
> Thanks,
> Tom.
tomj@softhome.net - 23 Jan 2006 15:00 GMT
Form2 instance is disposed.

USING statement help (C# Reference):
Defines a scope, outside of which an object or objects will be
disposed.

Thanks,
Tom.
Simon Hart - 24 Jan 2006 15:28 GMT
Only if you are explicity calling Dispose(true) from within your
implementation of IDisposable's Dispose.

> Form2 instance is disposed.
>
[quoted text clipped - 4 lines]
> Thanks,
> Tom.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.