Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

You receive an error message "You do not have a license to use this control" when you use Visual Basic 6.0 controls in Visual Studio 2005 or in Visual Studio .NET


View products that this article applies to.

Symptoms

When you use Microsoft Visual Basic 6.0 ActiveX controls in Microsoft Visual Studio 2005 or in Microsoft Visual Studio .NET, you may experience the following problems:
  • When you try to add an ActiveX control that was included with Visual Basic 6.0 to a form in Visual Studio 2005 or in Visual Studio .NET, you receive the following error message:
    You do not have a license to use this ActiveX control.
    You can add the control to the toolbox successfully, but you receive this error message when you add the control at design time.
  • When you upgrade a Visual Basic 6.0 project to Visual Studio 2005 or to Visual Studio .NET, you receive the following error message when the Upgrade Wizard parses in the forms:
    Visual Basic Upgrade Wizard error
    Upgrade failed: Exception occurred: Could not load referenced component: comdlg32.ocx(1.2.0)
    You need to install this component before you upgrade the project. It is recommended you install VB6.0, with all referenced components, and ensure the application compiles and runs before upgrading.
    When you click OK, the Upgrade Wizard closes, and the conversion process stops.

↑ Back to the top


Cause

You must have a design-time license to use Visual Basic 6.0 ActiveX controls. These errors occur because the system registry does not contain the design-time license information. When you upgrade a project that contains Visual Basic 6.0 ActiveX controls, or when you try to use Visual Basic 6.0 ActiveX controls on a form in Visual Studio 2005 or in Visual Studio .NET, those controls must be installed and licensed on the target system.

Visual Studio 2005 and Visual Studio .NET do not install the license information for Visual Basic 6.0 ActiveX controls unless the Visual Basic 6.0 controls are installed on the computer that is running Visual Studio 2005 or Visual Studio .NET. This behavior may occur if Visual Basic 6.0 was never installed on the computer.

You do not receive these errors on a computer on which both Visual Basic 6.0 and Visual Studio 2005 or Visual Studio .NET are installed because Visual Basic 6.0 installs the components and registers the licenses.

↑ Back to the top


Resolution

To resolve this problem, you must install the .ocx files for the ActiveX controls on the computer before you upgrade the project or before you use Visual Basic 6.0 ActiveX controls on a form in Visual Studio 2005 or in Visual Studio .NET. To do this, use one of the following methods:
  • Install Visual Basic 6.0 on the computer that is running Visual Studio 2005 or Visual Studio .NET.
  • Add the licensing keys to the registry.

Method 1: Install Visual Basic 6.0 on the computer that is running Visual Studio 2005 or Visual Studio .NET

Unlike earlier versions of Visual Basic, there are no conflicts between Visual Basic 6.0 and Visual Studio 2005 or Visual Studio .NET when you install these programs on the same system. In many cases, Microsoft recommends that you install Visual Basic 6.0 on the computer that is running Visual Studio 2005 or Visual Studio .NET.

If Visual Basic 6.0 is available on the computer, you can change the original Visual Basic 6.0 project more easily before you upgrade to Visual Studio 2005 or to Visual Studio .NET. For more information about how to install Visual Basic 6.0 and how to upgrade a project from Visual Basic 6.0 to Visual Studio 2005 or to Visual Studio .NET, see the "References" section.

Method 2: Add the licensing keys to the registry

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 How to back up and restore the registry in Windows


To add the licensing keys for the Visual Basic 6.0 controls to the registry, follow these steps:
  1. Insert the Visual Studio 2005 or Visual Studio .NET Installation Disk that has the \Extras\VB6 Controls folder in the in the CD-ROM or DVD-ROM drive. The following list describes what disk to use for each product edition on CD-ROM:

    Visual Studio 2005 (not the Microsoft Developer Network [MSDN] disk)
    • Professional Edition - Disk 2
    • Standard Edition - Disk 1
    Note The VB6Controls.reg registry file is not on the distribution media for any Visual Studio 2005 product.

    Visual Studio .NET 2003 (not the MSDN disk)
    • All Enterprise Editions - Disk 2
    • Professional Edition - Disk 2
    • Standard Edition - Disk 1
    • Academic Edition - Disk 2
    Visual Studio .NET 2002 (not the MSDN disk)
    • All Enterprise Editions - Disk 4
    • Professional Edition - Disk 4
    • Standard Edition - Disk 3
    • Academic Edition - Disk 4
  2. Click Start, and then click Run.
  3. In the Run dialog box, type regedit, and then click OK.
  4. In the Registry Editor dialog box, click Import on the File menu.
  5. Locate the \Extras\VB6 Controls folder on the Installation CD-ROM, select the VB6Controls.reg file, and then click Open. This step inserts all of the Visual Basic 6.0 ActiveX Controls license keys in the registry.

↑ Back to the top


Status

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

↑ Back to the top


More information

The .ocx files are located in the SYSTEM32 subfolder of the Windows folder. The following list includes some of the ActiveX controls and their corresponding file names:
  • ADO Data Control 6.0 (OLEDB) - Msadodc.ocx
  • Chart Control 6.0 - Mschrt20.ocx
  • Chart Control 6.0 (OLEDB) - Mschrt20.ocx
  • Comm Control 6.0 - Mscomm32.ocx
  • Common Dialog Control 6.0 - Comdlg32.ocx
  • Data Bound Grid Control 5.0(SP3) - Dbgrid32.ocx
  • Data Bound List Controls 6.0 - Dblist32.ocx
  • DataGrid Control 6.0 (OLEDB) - Msdatgrd.ocx
  • DataList Control 6.0 (OLEDB) - Msdatlst.ocx
  • FlexGrid Control 6.0 - Msflxgrd.ocx*
  • Internet Transfer Control 6.0 - Msinet.ocx
  • MAPI Controls 6.0 - Msmapi32.ocx
  • Masked Edit Control 6.0 - Msmask32.ocx
  • Multimedia Control 6.0 - Mci32.ocx
  • RemoteData Control 6.0 - Msrdc20.ocx
  • PictureClip Control 6.0 - Picclp32.ocx
  • Rich TextBox Control 6.0 - Richtx32.ocx
  • SysInfo Control 6.0 - Sysinfo.ocx
  • Windowless Controls 6.0 - Mswless.ocx
  • Windows Common Controls - Comctl32.ocx
  • Windows Common Controls 6.0 - Mscomctl.ocx
  • Windows Common Controls-2 5.0 (SP2) - Comct232.ocx
  • Windows Common Controls-2 6.0 - Mscomct2.ocx
  • Windows Common Controls-3 6.0 - Comct332.ocx
  • Winsock Control 6.0 - Mswinsck.ocx
* In Visual Studio .NET 2002, the VB6Controls.reg file that included the license for FlexGrid Control 6.0 is wrong. However, in Visual Studio .NET 2003, the VB6Controls.reg file has been corrected.

Note You must have a Visual Studio license agreement to get this corrected Vb6control.reg file. There is no charge for this support service.

For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

↑ Back to the top


Steps to reproduce the behavior

Error when you try to add an ActiveX control to a form in Visual Studio 2005 or in Visual Studio .NET

  1. Install Visual Studio 2005 or Visual Studio .NET on Computer A. Make sure that Visual Basic 6.0 has never been installed on this computer.
  2. Install only Visual Basic 6.0 on Computer B.
  3. Copy a Visual Basic .ocx file from the SYSTEM32 folder of Computer B to the SYSTEM32 folder of Computer A.
  4. On Computer A, start Visual Studio 2005 or Visual Studio .NET, and then create a new Windows Application project in Microsoft Visual Basic 2005 or in Microsoft Visual Basic .NET.
  5. Right-click in the toolbox, and then click Customize Toolbox.
  6. On the COM Components tab, click Browse.
  7. Select the .ocx file that you copied in step 3, and then click Open. Notice that the control is added to the list and that its check box is selected. Click OK.
  8. Drag the ActiveX control from the toolbox onto the form. You receive the following error message:
    You do not have a license to use this ActiveX control.

Upgrade Wizard error

  1. Install Visual Studio 2005 or Visual Studio .NET on a computer where Visual Basic 6.0 has never been installed.
  2. Start Visual Studio 2005 or Visual Studio .NET.
  3. On the File menu, click Open.
  4. Select a Visual Basic 6.0 project that contains an ActiveX control on the form, and then click OK. This starts the Upgrade Wizard.
  5. Complete the steps in the Upgrade Wizard. You receive the following error message:
    Visual Basic Upgrade Wizard error

    Upgrade failed: Exception occurred: Could not load referenced component: comdlg32.ocx(1.2.0)
    You need to install this component before you upgrade the project. It is recommended you install VB6.0, with all referenced components, and ensure the application compiles and runs before upgrading.
  6. Click OK in the error message dialog box. Notice that the Upgrade Wizard closes.

↑ Back to the top


References

For more information, click the following article number to view the article in the Microsoft Knowledge Base:
311324 Install Visual Basic .NET or Visual Basic 2005 on the same computer as a Visual Basic 6.0 upgrade project

↑ Back to the top


Keywords: kbprb, kbvs2005swept, kbvs2005applies, kbtshoot, kberrmsg, KB318597

↑ Back to the top

Article Info
Article ID : 318597
Revision : 9
Created on : 9/22/2006
Published on : 9/22/2006
Exists online : False
Views : 2421