473,387 Members | 1,664 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,387 software developers and data experts.

Correct use of dispose

Hi,
I have a class with a handle to a window and a handle to its icon (if
it has one).

What do i need to do to correctly free these resources when my class is
disposed?

Cheers,
James.

Jan 22 '07 #1
2 1371
James,

See "Implementing a Dispose Method" in MSDN.

http://msdn2.microsoft.com/en-us/library/fs2xkftw.aspx

Brian

pigeonrandle wrote:
Hi,
I have a class with a handle to a window and a handle to its icon (if
it has one).

What do i need to do to correctly free these resources when my class is
disposed?

Cheers,
James.
Jan 22 '07 #2
That'll clean itself up, you dont need to do anything.

you only need to put code in dispose to free up external resources used by
the form or class.

"pigeonrandle" <pi**********@hotmail.comwrote in message
news:11**********************@v45g2000cwv.googlegr oups.com...
Hi,
I have a class with a handle to a window and a handle to its icon (if
it has one).

What do i need to do to correctly free these resources when my class is
disposed?

Cheers,
James.

Jan 22 '07 #3

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

Similar topics

9
by: kjon | last post by:
I always dispose any object with the following: If not (obj1 is nothing) then obj1.dispose Now I wonder if that is the correct way of disposing an object? Should I use obj1 = Nothing after the...
3
by: Marius Rus | last post by:
I have a project in C# that do the followings: From an csv text file it is taking datas and inserted into an paradox database. My problem it is that when writing into the paradox database it is...
1
by: Flix | last post by:
When making c# programs, I usually write code like this: SomeType myType=null; void Init() { myType=new SomeType(); }
6
by: Rob Meade | last post by:
Hi all, Ok - I've used the word gramatically - which I'm sure is incorect, however I mean when VS2005 lists "warnings" like this one: Warning 1 Variable 'Command' is used before it has been...
2
by: Julio Allegue | last post by:
I am getting the wrong Count(*) on vb.net using the ExecuteScalar . It returns all the rows. It doesn't seem to look at the WHERE clause. At the same time, I am getting the correct count on "SQL...
0
by: Atara | last post by:
regarding the answers I got from the thread "Does each "New" needs a corresponding "Dispose" " (http://www.developersdex.com/vb/message.asp?p=&r=3582570&page=2) I have some questions: Till now,...
3
by: Chris | last post by:
I am just wondering if I did this the best way possible. I needed to add a double boarder around a label box. So I made a pen in the class, and do the drawing of the rectangles in the onpaint...
7
by: garyusenet | last post by:
Hi I have finally made progresss with my use of the open file dialog box! I have now made my own method that opens the dialog box and returns the file selected. Can you please have a quick...
2
by: Rob Meade | last post by:
Hi there, I have my own "way" I guess of coding, like we all do, whilst I try to maintain consistency throughout my own applications I often wonder whether there are better ways of doing...
9
by: seep | last post by:
hi i m finding following error on the code that i wants to use to get all record from table via store procedure with paging. the error is : Input string was not in a correct...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.