Select the product you need help with
How to use ActiveX components in Visual Basic .NET or in Visual Basic 2005Article ID: 315847 - View products that this article applies to. This article was previously published under Q315847 On This PageSUMMARY
This article demonstrates how to use an ActiveX component from within Visual Studio .NET by using Visual Basic .NET or within Visual Studio 2005 by using Visual Basic 2005. RequirementsThe following list outlines the recommended hardware, software, network infrastructure, and service packs that you need:
Using ActiveX Components from Visual Studio .NET or from Visual Studio 2005You can use ActiveX components from within Microsoft Visual Studio .NET or Microsoft Visual Studio 2005 code by using the Microsoft .NET Framework Component Object Model (COM) interoperability layer (or COM Interop). With Visual Studio .NET or Visual Studio 2005, you can easily access and use ActiveX components.NOTE: This article uses a simple ActiveX component named MyActiveXComponent for demonstration purposes. This component contains a single class, MyClass, with a single method, Add. The Add method adds two numbers together and returns the sum. Refer to the Complete Code Listing for MyActiveXComponent section for the source code of this component. The techniques in this article apply to any ActiveX component.
Complete Visual Basic .NET Code ListingComplete Code Listing for MyActiveXComponentTroubleshootingAs with any other COM component, you must register ActiveX components before you can use them. Make sure that you use a tool such as Regsvr32.exe to register MyActiveXComponent.REFERENCES
For more information, refer to the following Microsoft Web sites:
.NET Interop: Get Ready for Microsoft .NET by Using Wrappers to Interact with COM-based Applications http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmag01/html/INTEROP.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmag01/html/INTEROP.asp)
Using ActiveX Controls with Windows Forms in Visual Studio .NET http://msdn2.microsoft.com/en-us/library/ms973200.aspx
(http://msdn2.microsoft.com/en-us/library/ms973200.aspx)
Properties | Article Translations
|


Back to the top








