Using ActiveX Controls

ActiveX controls are a client-side technology, not a server-side technology. It doesn't matter whether the controls are hosted on an HTML, ASP, or ASP.NET page; in every case, it's up to the browser to handle the ActiveX control.

To drag and drop ActiveX controls on your Web form just like an ASP.NET Web control, you need to take the following steps in Visual Studio .NET:

  1. Create a new Visual C# ASP.NET Web Application project.

  2. Select Tools, Customize Toolbox to invoke the Customize Toolbox dialog box.

  3. Select the COM Components tab in the Customize Toolbox dialog box.

  4. Scroll down the list of components, which includes all the ActiveX controls registered on your computer, until you find the control you want to add to your project. Click the check box for the control, and then click OK to add the control to the Toolbox.

  5. The new control shows up at the bottom of the Toolbox. You can click and drag the control to a form just like any native .NET control.

graphics/alert_icon.gif

Remember, any ActiveX control that you use on a Web form must be present on (or downloaded to) the client's computer to function. You can include a codebase tag that specifies a download location for the control, if necessary.


You should consider the following issues before you use ActiveX controls in your .NET applications:

  • If the ActiveX control isn't already present on the client, it needs to be downloaded when your page is sent to the client, potentially involving a long delay.

  • Because ActiveX controls are not managed code, they don't get any of the protection the Common Language Runtime (CLR) brings to your .NET applications.

  • In the .NET Framework, a native Windows forms control can be hosted in Internet Explorer, eliminating the need for ActiveX controls. Before importing an ActiveX control into your project, you should consider whether a native .NET control could fulfill your requirements.



MCAD Developing and Implementing Web Applications with Visual C#. NET and Visual Studio. NET (Exam [... ]am 2)
MCAD Developing and Implementing Web Applications with Visual C#. NET and Visual Studio. NET (Exam [... ]am 2)
ISBN: 789729016
EAN: N/A
Year: 2005
Pages: 191

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net