Technical Training
VB.NET 2005ActiveX Controls and Legacy Code
Working with Legacy Code - ActiveX Control
In this tutorial you will learn how to use ActiveX Control, the windows forms ActiveX Control Importer, Importing Controls with Toolbox, Using ActiveX Controls on Windows Forms and you will also learn how to use Platform Invoke.
As enterprises grow in strength and reach, IT challenges loom large. All enterprises are confronted with a multitude of legacy applications that are not scaleable or in line with the applications being created for the new environment. However, these applications cannot be thrown out for various reasons. They have to be migrated and made compatible with the current set of applications being created to exploit the use of the Internet, e-commerce, the extranet and other new technologies. The .NET framework provides the foundation for creating a Legacy Application Interface solution using Microsoft technologies. The effort is to make the potential of distributed computing a reality. Developers can focus upon the business logic while the .NET framework tools take care of the details of formatting, transporting data and so on.
In this lesson we shall focus on how legacy code is to be handled in Visual Basic.NET 2.0 BETA within the .NET Framework.
Using ActiveX Controls
The windows forms ActiveX Control Importer
Windows Forms ActiveX Control Importer (Aximp.exe) is used to convert the type definitions in a COM type library for an ActiveX control into a Windows Forms control. Windows Forms are designed to host Windows Forms controls, namely the classes that are derived form System.Windows.Forms.Control. To facilitate the use of the ActiveX controls to be used in Windows Forms, Aximp.exe generates a wrapper class for an ActiveX control that can be hosted on a Windows Forms Controls. This will generate a wrapper control that derives from System.Windows.Forms.AxHost. This wrapper control has an instance of the underlying ActiveX control. It has knowledge of the ways to communicate with the ActiveX control methods and events as those of the generated control. The usage of the tool is given below:
Aximp [options] [.dll file | .ocx file]
Some of the options that can be used with this tools and the description are given below:
CLR proxy form COM types:
Windows Forms proxy for ActiveX controls : Ax
In designing applications with Visual Studio, the ToolBox is a very useful facility. The Visual Basic.NET developer deals with a number of classes during the course of developing an application. Controls are created and components created are reused repeatedly. The .dll files are referenced for creating an instance of an object. These controls can also be imported into the ToolBar for drag and drop facility.
The ToolBar is seen in the screenshot shown below at the left hand side of the viewer.

The ToolBox can be kept floating or docked. It can be a tabbed document, visible or hidden. The tool bar also contains many groupings. Groupings can be added as and when needed by right-clicking the tool box and choosing the options add tab. Tabs can be added, deleted or renamed. They can be grouped according to categories.
Controls can be created ab initio or by extending from another control, form or User defined control. These controls will appear on the ToolBox when added to it.
The process is illustrated in the screen shot below. Right click on the Toolbox, Choose the option to be added by clicking on the ‘Choose items’ from the context sensitive menu.

The Choose Items DialogBox appears. All the controls available are displayed to the user for selection. The Browse button gives further access to the user to navigate to the location of controls (.dll) which are not displayed in the list. After importing to the application the control is automatically, such controls or components are made available on the ToolBox which can be consumed by dragging and dropping.
VB.NET 2005
- VB.NET 2005 Free Training
- The .NET Framework Architecture Part 1
- The .NET Framework Architecture Part 2
- Application Class and Message Class
- Implementing Class Library Object
- Visual Studio.NET Namespaces
- .NET Assemblies
- Differences between VB.NET 1.0 and VB.NET 2.0
- Introducing VB.NET Windows Forms
- Visual Studio Windows Forms Designer
- Exploring the Forms Designer generated code
- Setting and Adding Properties to Windows Form
- Implementing Inheritance
- Event Handling In Visual Basic .NET
- Building Graphical Interface elements
- .NET Common Windows Forms Controls Part 1
- .NET Common Windows Forms Controls Part 2
- Common Controls and Handling Control Events
- DomainUpDown and NumericUpDown Controls
- Dialog Boxes in Visual Basic .NET
- Visual Studio Adding Controls to Windows Form
- VB.NET Validation Controls
- Working with Menu Controls
- VB.NET MDI Applications
- .NET Exceptions
- VB.NET Creating and Managing Components Part 1
- VB.NET Creating and Managing Components Part 2
- Simple Data Binding
- .NET Complex Data Binding
- .NET Data Form Wizard
- Data Manipulation with ADO.NET
- SQL Server Stored Procedures
- SQL Server Ad Hoc Queries
- Finding and Sorting Data in DataSets
- ADO.NET Object Model
- Working with DataSets
- Using XML Data
- Working with File System in .NET
- Creating Web Service
- Instantiating - Invoking Web Services, Creating Proxy Classes with WSDL
- Web Reference and Web Services
- Web Services - SOAP, WSDL, Disco and UDDI
- Web Application Testing in VB.NET 2005
- Web Application Tracing and Debugging
- Working with Legacy Code and COM Components
- ActiveX Controls and Legacy Code
- Windows Application Testing
- VB.NET Windows Application Testing
- Tracing VB.NET Windows Application
- Debugging Windows Applications In Visual Studio.NET 2005
- Deploying Windows Applications In Visual Studio.NET 2005
- Customizing Setup Project in Visual Studio.NET 2005
- Shared Assembly
- Microsoft .NET Creating Installation Components
- The Registry Editor in Visual Studio.NET 2005
- The File Types Editor







