How to Register a VB6 OCX

Written by david somerset
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Register a VB6 OCX
Register a Visual Basic OCX file using computer programming code. (ANSI image by DBX60 from

Microsoft Visual Basic 6.0 is a powerful platform for creating Windows applications. It installs a number of OCX files with its installation process. However, developers often unregister these files while they are working on projects in Visual Basic. If you have unregistered a Visual Basic 6.0 OCX and want to register it again, you can do so from within the Visual Basic program itself using a few commands and some code provided by Microsoft.

Skill level:


  1. 1

    Open Visual Basic 6.0 from a desktop shortcut or your Start menu. Choose "File," then "New Project." Set the type as "Standard EXE."

  2. 2

    Add a new module to the project. Name the module "Module1" or any other basic title you prefer.

  3. 3

    Copy the example code provided by Microsoft (see References) into the "General Declarations" section of the module you created. Replace all instances of "ComCtl32" in the code with the name of the Visual Basic 6.0 OCX file that you want to register.

  4. 4

    Press "Control" and "G"at the same time to view the immediate window. Type in "RegisterYourOCX" where "YourOCX" is the name of the OCX file you are registering ("ComCtl32" in the example). Press "Enter" to register the OCX file.

Tips and warnings

  • You must replace all instances of "ComCtl32 " in the sample code with the name of the OCX file you want to register or Visual Basic will not correctly register the OCX.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.