An Interop UserControl is created in Visual Studio .NET by opening a new project that uses the Visual Basic 6.0 Interop UserControl template. The resulting project looks and behaves like a Windows Control project, except that the resulting control class contains code that allows the control to be consumed in Visual Basic 6.0. An additional module, ActiveXControlHelpers.cs, contains additional functions that help provide interoperability.

To create an Interop UserControl project

  1. Open Visual Studio .NET.
  2. On the File menu, click New Project.
  3. In the New Project dialog box, select the Visual C# node under Installed Templates, and then select the VB6 Interop UserControl template from the list.
  4. Enter a name for the project and click OK.
Additional Interop UserControls can be added to an existing project to provide a control library by using the Visual Basic 6.0 Interop UserControl item template. In this case, only the control template is added to the project; the ActiveXControlHelpers.cs module is shared between the controls.

Note that the Interop UserControl item template is only available in Interop UserControl projects; it cannot be used in other project types.

To add another Interop UserControl

  1. In your Interop UserControl project, on the Project menu click Add New Item.
  2. In the Add New Item dialog box, select the VB6 Interop UserControl template.
  3. Enter a name for the control and click OK.
Note: The icon that will be displayed in the Visual Basic 6.0 Toolbox can be customized for each control. For information on how to do this, see the comments in the ActiveXControlHelpers.cs file in the Interop UserControl project.

Last edited Jan 16, 2012 at 5:29 AM by HolisticDeveloper, version 1

Comments

No comments yet.