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 / General / October 2004

Tip: Looking for answers? Try searching our database.

Do you use a form's Dispose Method?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
thelenj - 28 Oct 2004 19:39 GMT
I create a form in a sub.
The form just displays some information for the user and then the user may
close it.

Should I be calling the forms Dispose method?
Why?
Jay B. Harlow [MVP - Outlook] - 28 Oct 2004 20:29 GMT
Thelenj,
If you use Form.Show, then you DO NOT need to use Form.Dispose.

If you use Form.ShowDialog, then you NEED to use Form.Dispose.

The reason being is that a modeless form (Form.Show) calls Form.Dispose as
part of its closing event. Where as a modal form (Form.ShowDialog) does not
call Form.Dispose as part of its closing event, allowing you to retrieve
values from any controls after showing the dialog.

For details see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fSystemWindowsFormsFormClassCloseTopic.asp


Hope this helps
Jay

>I create a form in a sub.
> The form just displays some information for the user and then the user may
> close it.
>
> Should I be calling the forms Dispose method?
> Why?

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.