Developer,
Everything that has unmanaged resources and has a dispose method.
Be aware that 20% of the methods have dispose, just because they inherit
from component model.
It has not much sense to dispose every label, textbox, button etc just
because it has the method dispose.
Be aware that in the designer part of a form and a component is the code for
the standard Idisposable implementation.
Unmanaged resources (don't mix this up with managed *code*) are mostly
related to methods which interact outside your processor or a part of the OS
and not really a Net class. (Showdialog uses the dialog from the OS).
However there are much more times that it is useless than that it has sense.
By instance in the system.data namespace (adonet) there is AFAIK never a
reason to use dispose. That namespace inherits completly the component
model.
I hope this helps,
Cor
" **Developer**" <RE*************@a-znet.com> schreef in bericht
news:eI**************@TK2MSFTNGP11.phx.gbl...
What should I Dispose.
For example, in the following what should I Dispose and what happens if I
don't?
Thanks
Dim PS As New PrinterSettings
PS.PrinterName = pD.DefaultPageSettings.PrinterSettings.PrinterName
PS.DefaultPageSettings.Landscape = False
If PS.IsValid Then
Dim GrPrinter As Graphics = PS.CreateMeasurementGraphics()
Dim Hdc As IntPtr = GrPrinter.GetHdc()
--snip---