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
 
Back
Top