472,993 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,993 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 1359
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.