how to use activex control in net activex


How to use ActiveX Control in .Net ?

ActiveX control is a special type of COM component  that supports a User Interface. Using

ActiveX Control in your .Net Project is even simpler than using COM component. They are bundled usually in .ocx files. Again a proxy assembly is made by .Net utility AxImp.exe (which we will see shortly) which your application (or client) uses as if it is a .Net control or assembly.

  • Making Proxy Assembly For ActiveX Control: First, a proxy assembly is made using AxImp.exe

(acronym for ActiveX Import) by writing following command on

Command Prompt:

C:>AxImp C:MyProjectsMyControl.ocx

This command will make two dlls, e.g., in case of above command

MyControl.dll

AxMyControl.dll

The first file MyControl.dll is a .Net assembly proxy, which allows you to reference the ActiveX as if it were non-graphical object.

The second file AxMyControl.dll is the Windows Control, which permits u to use the graphical aspects of activex control and use it in the Windows Form Project.

  • Adding Reference of ActiveX Proxy Assembly in your Project Settings: To add a reference of ActiveX Proxy Assembly in our Project, do this:

o Select Project Reference... (Select Add Reference from Project Menu).

o This will show you a dialog box, select .Net tab from the top of window.

o Click Browse... button on the top right of window.

o Select the dll file for your ActiveX Proxy Assembly (which is MyControl.dll) and click OK

o Your selected component is now shown in the 'Selected Component' List Box. Click OK again

Some More On Using COM or ActiveX in .Net

  • .Net only gives wrapper class or proxy assembly (Runtime Callable Wrapper or RCW) for COM or activeX control. In the background, it is actually delegating the tasks to the original COM, so it does not change your COM/activeX but just imports them.

 

Request for Solution File

Ask an Expert for Answer!!
DOT NET Programming: how to use activex control in net activex
Reference No:- TGS0310428

Expected delivery within 24 Hours