Do you use a form's Dispose Method?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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/d...rlrfSystemWindowsFormsFormClassCloseTopic.asp

Hope this helps
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top