ArcFM Desktop Overview > ArcFM Desktop Basics > ActiveX Controls |
An issue with .NET WinForms that contain ActiveX controls causes an error when the form is shutdown. To work around this error, modify the Dispose method in your control to dispose the ActiveX control and set its ContainingControl property to null before calling the form's base.Dispose method (shown below).
If you are using any ArcFM ActiveX (ocx) control, use the code below to properly dispose of the control and its constituent components before shutdown.
Assume that _myActiveXControl is your ActiveX control, modify your Dispose() method on the form as follows:
C# Snippet |
Copy Code
|
---|---|
protected override void Dispose( bool disposing ) { if( disposing ) { // Add these two lines to fix error _myActiveXControl.Dispose(); _myActiveXControl.ContainingControl = null; if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } |