Home All Groups Group Topic Archive Search About

Releasing resources...

Author
14 Feb 2006 7:14 PM
Pete Smith
I have written print application which prints multiple pages by calling
PrintPage event multiple times.

I am closing all the databases related objects resources when it is not
required.

Since I am new to the printing part of the application just wanted to make
sure what are all the print related object that I should close exclusively
to avoid resource bottle neck (just to make sure the that the resources are
released).

Few objects that I have used in the applications are.

Font, SolidBrush, Pen, StringFormat etc..

Thank you,

Vb.Net and .Net Framework 1.1.

Pete

Author
14 Feb 2006 9:42 PM
Cerebrus99
Hi Pete,

I don't believe that you would encounter a resource bottleneck under
"normal" conditions and if you are handling
the Font and other objects you mentioned, as expected, there is nothing that
you need to explicitly dispose of.

I assume here that you are using the PrintDocument class to do your
printing, and this is a Windows Application.

2 things to note however,

1. If you're reading the text to print, from a FileStream, then close it and
any attached StreamReaders.

2. When you finish with printing, set the "e.HasMorePages = False", where e
is the PrintPageEventArgs.

Happy Printing.

Regards,

Cerebrus.
=================================
Show quoteHide quote
"Pete Smith" <PeteSmit***@hotmail.com> wrote in message
news:Oqf#6qZMGHA.420@tk2msftngp13.phx.gbl...
>
>
> I have written print application which prints multiple pages by calling
> PrintPage event multiple times.
>
> I am closing all the databases related objects resources when it is not
> required.
>
> Since I am new to the printing part of the application just wanted to make
> sure what are all the print related object that I should close exclusively
> to avoid resource bottle neck (just to make sure the that the resources
are
> released).
>
> Few objects that I have used in the applications are.
>
> Font, SolidBrush, Pen, StringFormat etc..
>
> Thank you,
>
> Vb.Net and .Net Framework 1.1.
>
> Pete
>
>
>
>
Author
15 Feb 2006 1:09 AM
Dennis
Right or Wrong, I use the rule that if an object has a dispose method, then I
dispose of it when I'm thru with it.
--
Dennis in Houston


Show quoteHide quote
"Cerebrus99" wrote:

> Hi Pete,
>
> I don't believe that you would encounter a resource bottleneck under
> "normal" conditions and if you are handling
> the Font and other objects you mentioned, as expected, there is nothing that
> you need to explicitly dispose of.
>
> I assume here that you are using the PrintDocument class to do your
> printing, and this is a Windows Application.
>
> 2 things to note however,
>
> 1. If you're reading the text to print, from a FileStream, then close it and
> any attached StreamReaders.
>
> 2. When you finish with printing, set the "e.HasMorePages = False", where e
> is the PrintPageEventArgs.
>
> Happy Printing.
>
> Regards,
>
> Cerebrus.
> =================================
> "Pete Smith" <PeteSmit***@hotmail.com> wrote in message
> news:Oqf#6qZMGHA.420@tk2msftngp13.phx.gbl...
> >
> >
> > I have written print application which prints multiple pages by calling
> > PrintPage event multiple times.
> >
> > I am closing all the databases related objects resources when it is not
> > required.
> >
> > Since I am new to the printing part of the application just wanted to make
> > sure what are all the print related object that I should close exclusively
> > to avoid resource bottle neck (just to make sure the that the resources
> are
> > released).
> >
> > Few objects that I have used in the applications are.
> >
> > Font, SolidBrush, Pen, StringFormat etc..
> >
> > Thank you,
> >
> > Vb.Net and .Net Framework 1.1.
> >
> > Pete
> >
> >
> >
> >
>
>
>