Releasing resources...

P

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
 
C

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.
=================================
 
G

Guest

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.
 

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

Top