COM Error 80040154: Retrieving the COM Class Factory Failed


Using the wrong version of the ActiveX controls in your .NET application or if the required OCX file is not registered may cause the following error:

Retrieving the COM class factory for component with CLSID [ID] failed due to the following error: 80040154.

Cause

The OCX files that must be registered for your application depend on whether it is a 32-bit or 64-bit .NET application. 32-bit applications must register the x86 OCX files, while 64-bit applications must register the x64 OCX files.

The locations of these OCX files are as follows:

x86: The x86 OCX files are located in the 'lib' folder of the installation directory for the ActiveX product.  
x64: The x64 OCX files are located in the 'lib64' folder of the installation directory for the ActiveX product.  

Registering OCX Files

Registration automatically happens during installation of our ActiveX products.

Batch File Registration

You can find batch files named register.bat and unregister.bat for registering and unregistering all of your OCX files in the 'lib' and 'lib64' directories.

To register the 32-bit OCX files, run the register.bat file located in the lib directory.

Single File Registration

If you want to register only a single OCX file, you can use the command:

regsvr32 ocxfilename

We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@nsoftware.com.