473,396 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Releasing resources...



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


Feb 14 '06 #1
2 1216
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" <Pe*********@hotmail.com> wrote in message
news:Oq*************@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

Feb 14 '06 #2
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
"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" <Pe*********@hotmail.com> wrote in message
news:Oq*************@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


Feb 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: lebo | last post by:
Hi I'm trying to understand how Python handles memory usage and dynamic object loading and unloading. Problem to solve? Build a very low memory footprint (non-GUI) Python application for...
0
by: Steve Guidi | last post by:
Hello, I'm developing an application that periodically reads embedded assembly resources. The resources are text-based, and are about 3-7KB in size, and the application accesses them by calling...
0
by: Phil | last post by:
I am using .NET Remoting for interaction between client/host. When my app. starts the aspnet_wp process goes from approx. 3mb to ~20mb. Each round-trip to the server adds anything from 6kb to 2.5mb...
7
by: trialproduct2004 | last post by:
Hi all I am having application in c# where i am loading one table of database into dataset. My table is of large size. so whenever i am loading that into dataset my memory size is getting...
5
by: Michael Tissington | last post by:
I have an application written in C++ (NOT .NET) which creates an instance of a vb .net object. My application releases the .net object when it has finished using it. However .NET GC is not...
0
by: Naved Ahmed | last post by:
In one of my project, I called ASP web service to convert some type of files. After conversion, web service is deleting that file. Still that file is shown by the windows Explorer (Even after...
0
by: 062699 | last post by:
Hi All, Thank you in advance. I am having trouble releasing resources when I open a child form. Please see the code below. Form f; private void button1_Click(object sender, EventArgs e) { ...
3
by: ssylee | last post by:
For example, I have a BITMAPINFO* and a BYTE* object to release the resources. Would the most bulletproof way of doing so involve checking to see if they are null, then if they are not, invoke a...
2
by: enggwaqas | last post by:
Hi guys, I have a memory problem in my vb.net application. It's actually a point of sales system, which must be keep running the whole day. The problem is: application is not releasing any memory...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.