ActiveX Controls – Attempting to run an application built under Windows Vista 64-bit editions results in runtime exception
SYMPTOMS
Attempting to run an application built under Windows Vista 64-bit editions results in runtime exception:
System.Runtime.InteropServices.COMException was unhandled
Message=”Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))”
Source=”System.Windows.Forms”
ErrorCode=-2147221164
StackTrace:
…
stack trace
…
The application will build successfully, but will throw an exception at runtime.
CAUSE
ActiveX Controls are 32-bit technology.
RESOLUTION
Applications using ActiveX Control must be built for 32-bit targets.
1. Open the ‘Properties’ page for your project.
2. Select the ‘Build’ tab.
3. In the ‘General’ section, click the ‘Platform Target’ dropdown list down arrow.
4. Select ‘x86’.
5. Close the ‘Properties’ page.
6. Rebuild the application.