You are currently offline, waiting for your internet to reconnect

PRB: Cannot Add ActiveX Control to Toolbox

This article was previously published under Q320780
This article has been archived. It is offered "as is" and will no longer be updated.
After you use Aximp.exe to wrap an ActiveX control, you may receive the following error message when you try to add the Ax wrapper to the .NET Framework Components tab in the Customize Toolbox dialog box:
There are no components in fully qualified path to the Ax wrapper dll that can be placed on the toolbox.
By default, the ToolboxItem attribute is set to False in the generated Ax wrapper. A False value for this attribute prevents the control or wrapper from being added to the Toolbox.
There are two resolutions to this problem:
  • Import the Control by Using the Development Environment

    The easiest way to avoid this problem is to add the ActiveX control to the Toolbox from the COM Components tab instead of by running Aximp.exe and using the .NET Framework Components tab in the Customize Toolbox dialog box. The development environment generates the wrappers that you need when you add the control through the COM Components dialog box.
  • Manually Change the Attribute Value
    1. NOTE: All of the file names in the commands in step 1 and step 3 must be fully qualified path names.

    2. Run Aximp.exe with the /source switch to generate the Visual C# code for the Ax wrapper for the specified ActiveX control. The file generates the source file, an interop assembly, and an Ax wrapper assembly for the specified control. For example, the following command generates the Visual C# source code (Axmscomdlg.cs) for the Ax wrapper for the Microsoft Common Dialog Control:
      aximp comdlg32.ocx /out:AxMSComDlg.dll /source						
    3. Open the Visual C# source file in a text editor such as Notepad, insert the following attribute statement, and then save the .cs source file:
      NOTE: Make sure that you insert the statement after the namespace and before the class definition.

    4. Use the following command to compile the .cs file:

      NOTE: Make sure that you reference the runtime callable wrapper (RCW) assembly:
      csc /t:library /r:MSComDlg.dll /out:AxMSComDlg.dll AxMSComDlg.cs						
Aximp.exe converts a whole ActiveX Control type library at one time and produces a set of assemblies that contain the Common Language Runtime meta data and control implementation for the types that are defined in the original type library. The generated files are named according to the following pattern:
  • Common Language Runtime proxy for COM types: Progid.dll
  • Windows Forms proxy for ActiveX controls (where Ax signifies ActiveX): AxProgid.dll
For the control that is used as an example in this article (Comdlg32.ocx), the files that are created are Mscomdlg.dll and Axmscomdlg.dll.)

Steps to Reproduce the Problem

This problem can be reproduced by using any ActiveX control. The Microsoft Common Dialog Control (Comdlg32.ocx) is used in this example.
  1. Execute the following command from a Visual Studio .NET command prompt:
    aximp comdlg32.ocx /out:AxMSComDlg.dll /source					
    NOTE: This command generates the Ax wrapper (Axmscomdlg.dll), the RCW (Mscomdlg.dll), a program database file (Axmscomdlg.pdb), and the Visual C# source file (Axmscomdlg.cs) for the Ax wrapper.

  2. Start a new Visual Basic or Visual C# Windows Application project. By default, Form1 is created.
  3. On the Tools menu, click Customize Toolbox.
  4. Click the .NET Framework Components tab.
  5. Click Browse, and then locate the folder that contains the Ax wrapper that was generated in step 1.
  6. Click to select Axmscomdlg.dll, and then click Open. You receive the error message that is described in the "Symptoms" section.

Article ID: 320780 - Last Review: 12/07/2015 10:28:22 - Revision: 2.1

Microsoft Visual C# .NET 2002 Standard Edition, Microsoft Visual Basic .NET 2002 Standard Edition, Microsoft Visual J# .NET 2003 Standard Edition

  • kbnosurvey kbarchive kbdocerr kbprb KB320780