VB6 Error - Cannot load .ocx File

29,620

Solution 1

This it may be a dependency issue -- some other component needed by the OCX is not present. Dependency Walker will find any static dependencies.

Solution 2

Just a couple of tips to help isolate the problem....

Look at the control with OleView

Examine the name: if it is one of the reserved words such as 'Menu', vb6 will fail to load it. (Although vb6 will happily let you create (and use) one with a bad name until it is saved and reloaded)

Examine the interface: does it describe the functionality? You may have a damaged or unlicensed ocx.

Attempt to load it with the ActiveX Control Test Container... If you can, the problem is with VB6 and not the ocx.

Solution 3

We fixed similar error recently. In our case the error was in the Visual Basic project (.vbp) file. Project file had been edited outside standardized build machine and contained references to OCX components - including workstation specific paths & versions of the components.

You can either edit the the project file in text editor or get a working version from version control.

Solution 4

Un-registering and registering again worked for me too.
Please note that you need to register this component using this syntax:

regsvr32 /i:design olch2x8.ocx
Share:
29,620
Jason Lowenthal
Author by

Jason Lowenthal

Jason Lowenthal is an Architectural Software Engineer based in Springfield, MO. A graduate from Drury University, his past work includes stints with Bass Pro Shops, O’Reilly Automotive Inc. and Paperwise. When not contributing his time and talents to his employer, Skyfactor, Jason spends his free time raising his 3 girls, blogging and learning about new technology.

Updated on April 26, 2020

Comments

  • Jason Lowenthal
    Jason Lowenthal about 4 years

    I have been trying to load a OCX file into one of my VB6 projects for most of the day today. I've tried checking the COM registration in the registry the best that I know how, and have attempted several times using REGSVR32 on the file to no avail. All I keep getting from VB6 when I try to load the component (Under Project --> Components) is 'FilePath\FileName.ocx' could not be loaded. Has anyone else seen this before, and if so, any ideas how to fix it?