Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21243

How to correctly dispose of an controls in an ocx

$
0
0
Hi all, I have developed an OCX that contains 3 webbrowser controls, and 3 frames. I am dynamically adding the webbrowser controls to the frames at runtime using

Set WebBrowser2 = Controls.Add("Shell.Explorer.2", "WebBrowser2", Frame2)

However when I add my ocx to word document, I get an error when I close the document. The error isn't very informative:
AppName: winword.exe AppVer: 9.0.0.2717 ModName: msvbvm60.dll
ModVer: 6.0.98.2 Offset: 00048991

I reckon it's because I am not correctly disposing of some of the controls. The question is, when do I dispose of the Webbrowser and Frame control? In the usercontrol_terminate event?

Thanks

Viewing all articles
Browse latest Browse all 21243

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>