By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,579 Members | 1,770 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,579 IT Pros & Developers. It's quick & easy.

Classes VB6 vs. VB.NET

P: n/a
In VB6 i use a Form and a Class module.

Dim MyClass as New Class1

In Form_Load:
Set MyClass = New Class1

In Form_Unload:
Set MyClass = Nothing

This works in VB6
But in .NET i can not destroy the class.
The class only destroys when i Close the application.
If i use the VB6 to .NET wizard, i get an upgrade note:

UPGRADE_NOTE: Object mycls may not be destroyed until it is garbage
collected. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1029"

So how do i destroy a class in .NET

Thanks
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Fri, 1 Oct 2004 20:19:23 +0200, "Soren Hyltoft" <sh@impuls-technic.dk> wrote:

In VB6 i use a Form and a Class module.

Dim MyClass as New Class1

In Form_Load:
Set MyClass = New Class1

In Form_Unload:
Set MyClass = Nothing

This works in VB6
But in .NET i can not destroy the class.
The class only destroys when i Close the application.
If i use the VB6 to .NET wizard, i get an upgrade note:

UPGRADE_NOTE: Object mycls may not be destroyed until it is garbage
collected. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1029"

So how do i destroy a class in .NET

Try using Marshal.ReleaseComObject:

http://msdn.microsoft.com/library/de...bjecttopic.asp
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 21 '05 #2

P: n/a
On Fri, 1 Oct 2004 20:19:23 +0200, "Soren Hyltoft" <sh@impuls-technic.dk> wrote:

In VB6 i use a Form and a Class module.

Dim MyClass as New Class1

In Form_Load:
Set MyClass = New Class1

In Form_Unload:
Set MyClass = Nothing

This works in VB6
But in .NET i can not destroy the class.
The class only destroys when i Close the application.
If i use the VB6 to .NET wizard, i get an upgrade note:

UPGRADE_NOTE: Object mycls may not be destroyed until it is garbage
collected. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1029"

So how do i destroy a class in .NET

Here is an example of how to use Marshal.ReleaseComObject:

http://support.microsoft.com/default...b;en-us;306682
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.