473,473 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

activeX doesn't dispose

Hi group,

Here at work they've got an activeX control which is used on a usercontrol,
and this usercontrol is one of the standard controls in the framework, so
this user controls get's used a lot on other usercontrols or windows forms.
But the problem is the activex control doesn't get disposed. (profiled the
app with scitech .net memory profiler 2.5) I added this code to disposing
event of the base usercontrol (the one in the framework which contains the
activeX):

'Grid is the name of the activeX control
'Toegevoeg door Peter 31/03/2005
If Not Grid Is Nothing Then
Grid.Dispose()
End If
'einde toevoeging

but that doesn't help, I also tried it in the usercontrol's finalize method
but also no success. But if I create a sub in the usercontrol:

Public sub MyDispose
If Not Grid Is Nothing Then
Grid.Dispose()
End If
End sub

and then in the form's closing event of the form that hosts the usercontrol
call

myusercontrol.Mydispose

the activex control get's disposed and releases it's memory.

But now my question is isn't there a way so I can dispose the activeX
control on the usercontrol from within the user control without the extra
sub.

Greetz Peter


Nov 21 '05 #1
7 5318
Use Garbage Collection (GC)
Nov 21 '05 #2
Hi,

thnx for the answer but I've always read/heard that you shouldn't use
gc.collect, except for in some special cases, is this one of them? Because
the form containing the usercontrol get's opened and closed a lot so
gc.collect would get executed a lot and doesn't this tend to mess up the gc?
Or have I miss understand you?

Greetz Peter

"Crouchie1998" <cr**********@discussions.microsoft.com> schreef in bericht
news:Ot**************@TK2MSFTNGP15.phx.gbl...
Use Garbage Collection (GC)

Nov 21 '05 #3
Peter,

I have no answer, however maybe you can find it on this page. At the bottom.
http://msdn.microsoft.com/library/de...classtopic.asp

I hope this helps,

Cor
Nov 21 '05 #4
Hi Cor,

thanks for the link

Greetz Peter

"Cor Ligthert" <no************@planet.nl> schreef in bericht
news:#j**************@tk2msftngp13.phx.gbl...
Peter,

I have no answer, however maybe you can find it on this page. At the bottom. http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemidisposableclasstopic.asp
I hope this helps,

Cor

Nov 21 '05 #5
But I forget to mention, it was interesting but it didn't help me out :-)
so I'm still puzzling

Greetz Peter

"Peter Proost" <pp*****@nospam.hotmail.com> schreef in bericht
news:eU**************@TK2MSFTNGP14.phx.gbl...
Hi Cor,

thanks for the link

Greetz Peter

"Cor Ligthert" <no************@planet.nl> schreef in bericht
news:#j**************@tk2msftngp13.phx.gbl...
Peter,

I have no answer, however maybe you can find it on this page. At the bottom.

http://msdn.microsoft.com/library/de...us/cpref/html/ frlrfsystemidisposableclasstopic.asp

I hope this helps,

Cor


Nov 21 '05 #6
Try something like this:

Imports System.Runtime.InteropServices

Marshal.ReleaseComObject(Grid)

Does that help?

Nov 21 '05 #7
Hi thanks for the tip and I'll try that but I'm not even sure anymore if it
has to do with the Grid, because if I test it in a test app with the same
activex on a usercontrol and that usercontrol on yet another usercontrol and
that one on a form there's no problem, so I think that it's some bad coding
in some of our classes that causes the whole usercontrol not to be released.
So that's going to be some more puzzling...

Greetz Peter

"Chris Dunaway" <du******@gmail.com> schreef in bericht
news:11**********************@z14g2000cwz.googlegr oups.com...
Try something like this:

Imports System.Runtime.InteropServices

Marshal.ReleaseComObject(Grid)

Does that help?

Nov 21 '05 #8

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

Similar topics

0
by: Ivan | last post by:
I have the SystemMonitor ActiveX control on a form and I try to register a custom performance counter. I expect that after registering the counter with the OS, the user would be able to add it...
0
by: jab_joe | last post by:
Hi, I've searched the internet high and low for someone else having had this problem and solved it. But every c# activeX controller sample I look at shared the same problem. And I can find no...
0
by: zevikw | last post by:
I am using an ActiveX control in a .NET application which I put on a form. I have another .NET control on that form that handles the Validating event. The method that handles the Validating event,...
4
by: Peter Merwood | last post by:
Hi My VB.NET project has a Form which wraps a proprietary ActiveX control. Efffectively the Form acts as a Class becuase the control must be placed on a Form. The Form is not displayed by the...
1
by: gilad | last post by:
Hi, I am trying to make an ActiveX-like control in C# per the following article: http://www.c-sharpcorner.com/Code/2003/March/ActiveXInNet.asp The control I make compiles, but when I added it...
0
by: Jeff | last post by:
Banging my head against the wall trying to figure this out. I have a 'sometimes' hang while disposing a form which contains an ActiveX control (Flash.ocx version 7). The form's Dispose() method...
4
by: Wilfried Mestdagh | last post by:
Hi, I have a C# application (VS2005) with Microsoft Mappoint activeX control on a form. At a certain moment I want to create a second one temporary in code. This seems not to work, when I try to...
1
by: Shaan2804 | last post by:
I have created a activex component in VB 6.0 which is using MS Word object library. I am calling this activex component in Asp.net application. This is causing the Word.exe process to run under...
0
by: Wade Yin | last post by:
Hi, I just wrote some simple code to test if the activex can work well in IE browser; after build it I got a ActiveXDemo.dll, but I don't konw how to test it :( And I get an example like...
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
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...
1
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...
1
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
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
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.