473,387 Members | 1,638 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.

Class_Terminate emulation

Is there anyway to force the equivalent to VB 6's Class_Terminate event when
a class object goes out of scope. I have several classes in VB 6 that
depend on the Class_Terminate event firing as soon as the class variable
goes out of scope and need to be able to duplicate this functionality in VB
2005.

Thanks,
Mike Ober.

Nov 21 '05 #1
1 2406
In article <eg**************@tk2msftngp13.phx.gbl>, Michael D. Ober wrote:
Is there anyway to force the equivalent to VB 6's Class_Terminate event when
a class object goes out of scope. I have several classes in VB 6 that
depend on the Class_Terminate event firing as soon as the class variable
goes out of scope and need to be able to duplicate this functionality in VB
2005.

Thanks,
Mike Ober.


The closest you can can get is to implement Dispose. Here is a
reference to the general pattern:

http://msdn.microsoft.com/library/de...izeDispose.asp

Once you have that, in VB.NET 2005 you can use the using statement (like
c#) to sort of fake deterministic finalization...

Using theVariable As New TheClass ()
'Do Stuff with theVariable
End Using

Dispose will automatically be called when you hit the end of the using
block - even if it is due to an exception. In versions previous to
2005, you would have to do something like:

Dim myVariable As New TheClass
Try
' do stuf with myVariable
Finally
myVariable.Dispose ()
End Try

HTH
--
Tom Shelton [MVP]
Nov 21 '05 #2

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

Similar topics

1
by: Enigman O'Maly | last post by:
I'm trying to convert some VBA routines in an Excel 2000 workbook to use objects instead of global varaibles. I've defined a class module with the following (excerpts): (from SheetMetrics class...
16
by: Chris | last post by:
Is there any way to make the class Z behave the same way as class Y? Chris class Y: value = 42 def __hasattr__(self, name): if name == '__int__': return True def __getattr__(self, name):
0
by: Pam Sheldon | last post by:
I have an app that uses data files. How can get the files over to the emulator so I can debug the app in the emulation mode? Microsoft does not say this is a limitation of the emulator. Pam
7
by: A Ratcliffe | last post by:
As you might have gathered from the Subject, I've been experimenting with using VBScript classes in my ASP pages to tidy the script up. Generally things are going well. Since I come from a C++...
3
by: Gilles Cadorel | last post by:
I'd like to add in a HTML page a button, that open a Unix Emulation on a new Windows, when I clik on it. I'm using WRQ Reflection to connect to Unix hosts. The problem is that I don't want the...
3
by: ShadowMan | last post by:
Hi all I've seen a lot of posts about frames emulation. I would like to emulate a: header, left-side menu, content, footer layout. I need to be cross browser compatible...but I'm get crazy!!!...
0
by: Jose Michael Meo R. Barrido | last post by:
I'm looking for a .net framework component to read write to Serial(Com port) that supports ANSI Emulation.
0
by: Maddog | last post by:
How do I enable Brief emulation as the editor in Visual Studio.Net? I can do it in Visual Studio 6.0.
1
by: Nathan Young | last post by:
Hello. I have a .net application that utilizes COM ports to communicate with serial devices (namely a GPS). This may not be the right group for this question, but bear with me as I am not sure...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.