The bitness of an .ocx control must match the bitness of the process into which it is being loaded. Since VS2022 is now a 64-bit process a 32-bit .ocx will not be loaded by the designer. Similarly, previous versions of VS were 32-bit processes and were incapable of loading a 64-bit COM component in their designers.
Trying to figure out why ocx file wont load form.
Program is able to run perfectly fine, but when trying to edit the form you get:
Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))Now the RBarcodex.ocx in question is registered to the system since the program is able to run in "run time" and run once is compiled.
1 additional answer
Sort by: Most helpful
-
RLWA32 45,701 Reputation points
2024-04-17T00:41:04.96+00:00 I used VS2019 to create a 32-bit .ocx control (MFCActiveX). I added the control to a .Net Framework Winforms project using VS2019. The I copied the Winforms project and the 32-bit .ocx control to a different VM that has VS2022 17.9 installed.
I registered the 32-bit .ocx control with regsvr32.exe and using notepad added the following line to the Winforms project properties.
<UseWinFormsOutOfProcDesigner>True</UseWinFormsOutOfProcDesigner>
This project property was discussed in the .Net blog article WinForms Designer Selection for 32-bit .NET Framework Projects. I added this to the .csproj for the Winforms project BEFORE I opened it in VS2022.
The project opened and the out-of-process designer loaded my test form with the 32-bit .ocx on it.
And the same solution works just as well in a VB .Net Framework Winforms project --