473,498 Members | 1,218 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Object destruction event

Is there a way in VB to get a notification when an object
is destroyed when that object does not have a terminate
event?

I am using a control that does not have a notification
event when it is destroyed. I need to know when the
object is destroyed so I can do some cleanup.

Thanks Chewie2112
Nov 20 '05 #1
2 1178
There is much that can be (and has been) said on this. Look for help on
Garbage Collection, The Dispose Method, The Finalize Method.

In a nutshell, in .NET you don't/won't know for sure when an object is
removed from the memory heap. You will know when it falls out of scope and
the Dispose method will fire at that point. Finalize with fire when the
object is actually being removed from the heap, but since you don't know for
sure when that is, you want to be very careful about using it.

"Chewie2112" <Ch********@someplace.com> wrote in message
news:05****************************@phx.gbl...
Is there a way in VB to get a notification when an object
is destroyed when that object does not have a terminate
event?

I am using a control that does not have a notification
event when it is destroyed. I need to know when the
object is destroyed so I can do some cleanup.

Thanks Chewie2112

Nov 20 '05 #2
Thanks for the quick reply. But I noticed I posted to the
DotNet group instead of the General VB group (I am not
using .Net). Sorry for waisting your time.

Chewie2112.
-----Original Message-----
There is much that can be (and has been) said on this. Look for help onGarbage Collection, The Dispose Method, The Finalize Method.
In a nutshell, in .NET you don't/won't know for sure when an object isremoved from the memory heap. You will know when it falls out of scope andthe Dispose method will fire at that point. Finalize with fire when theobject is actually being removed from the heap, but since you don't know forsure when that is, you want to be very careful about using it.
"Chewie2112" <Ch********@someplace.com> wrote in message
news:05****************************@phx.gbl...
Is there a way in VB to get a notification when an object is destroyed when that object does not have a terminate
event?

I am using a control that does not have a notification
event when it is destroyed. I need to know when the
object is destroyed so I can do some cleanup.

Thanks Chewie2112

.

Nov 20 '05 #3

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

Similar topics

7
1921
by: Luc Tremblay | last post by:
Given the typical following code: void Listener::HandleEvent(const Event& event) { // handling code } In a "clean" fashion, how is it possible to add custom data (to be subsequently...
6
2057
by: David Rogers | last post by:
When I, let's say I'm a form, register myself for an event, I use a syntax such as: Class1.EventName += new EventNameHandler(MyFormsEventHandler); Somewhere in global scope, I have defined the...
5
35960
by: Rich P | last post by:
I have to read data from an external source, massage the data, concatenate it to one long string, then write it to a textfile. So I am experimenting with the StringBuilder object. I append the...
9
2986
by: plahey | last post by:
I have been dabbling in Python for a while now. One of the things that really appeals to me is that I can seem to be able to use C++-style RAII idioms to deal with resource management issues. ...
15
8272
by: cedgington | last post by:
I wanted to take advantage of the large set of functionality offered by the framework, so for my latest project I'm using managed C++ with .NET v2. I'm using the gcnew operator in two different...
6
2230
by: Pablo | last post by:
Hello, I am writing a windows application using C++ and BorlandBuilder 6 compiler. It is an event driven program and I need to create objects of some classes written by me. One of the classes...
5
3321
by: Frederick Gotham | last post by:
If we have a simple class such as follows: #include <string> struct MyStruct { std::string member; MyStruct(unsigned const i) {
4
1956
by: gg9h0st | last post by:
i worte a simple code below. ------------------------------------------------------------------------------------ #include "stdafx.h" class Object { public: int a;
4
2024
by: Joergen Bech | last post by:
I sometimes use delegates for broadcasting "StateChanged" events, i.e. if I have multiple forms and/or controls that need updating at the same time as the result of a change in a global/common...
0
7124
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,...
1
6884
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
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5460
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4904
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...
0
4586
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
651
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.