none
Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) when installed on different PC

    Question

  • I developed a new complex VB 2008 Windows Forms Application last year. It was developed on a 64 bit PC using the Vista operating system, and developed in Visual Studio 2008 Professional. Active Solution Platform is x86.

    The application has been installed on XP PC's with no problems for over a year.

    I made a change to the application. Installed it on the Vista Development PC where it works fine. But,

    now when I install the application it install with no problems until the user opens the application. The following error message appears:

     

     "DeskTop Word Console has encountered a problem and needs to close"

    When I click on the "Debug Button" I get the following error message.

    Something has changed on my Vista development PC, and I cannot figure out what it is. Even when I publish and package a backup from before I made the change I get the seme problem.

    I re-installed Visual Studio SP 2 with no improvement.

    Please Help.

    Doug

    New Installation Error

    System.InvalidOperationException was unhandled

    Message="An error occurred creating the form. See Exception.InnerException for details. The error is: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))"

    Source="DeskTop Word Console"

    StackTrace:

    at DeskTop_Word_Console.My.MyProject.MyForms.Create__Instance__[T](T Instance)

    at DeskTop_Word_Console.My.MyProject.MyForms.get_frmMain()

    at DeskTop_Word_Console.My.MyApplication.OnCreateMainForm()

    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()

    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()

    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)

    at DeskTop_Word_Console.My.MyApplication.Main(String[] Args)

    InnerException: System.Runtime.InteropServices.COMException

    Message="Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))"

    Source="System.Windows.Forms"

    ErrorCode=-2147221164

    StackTrace:

    at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)

    at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)

    at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)

    at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)

    at System.Windows.Forms.AxHost.CreateInstance()

    at System.Windows.Forms.AxHost.GetOcxCreate()

    at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)

    at System.Windows.Forms.AxHost.CreateHandle()

    at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)

    at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)

    at System.Windows.Forms.AxHost.EndInit()

    at DeskTop_Word_Console.frmMain.InitializeComponent()

    at DeskTop_Word_Console.frmMain..ctor()

    InnerException:

    • Edited by Jzeznus Wednesday, June 2, 2010 4:55 PM
    Wednesday, June 2, 2010 4:18 PM

Answers

  • You're using an ActiveX or COM component in your project but it isn't registered on your Vista machine or you are missing the interop assembly (which should be in the bin folder).

    You may want to indicate which COM components you are using (check your References list).

    or...

    The problem could also be that you're running a 64-bit version of the OS. In which case you may need to compile your app for 32-bit only (Build...Configuration Manager...Platform...x86) in order to load 32-bit COM components.


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Wednesday, June 2, 2010 9:15 PM

All replies

  • There is some Interop in your code, that needs registering of the non Net parts of your program

    Have a look at regasm

    http://msdn.microsoft.com/en-us/library/tzat5yw6(VS.71).aspx


    Success
    Cor
    Wednesday, June 2, 2010 4:22 PM
  • Could you please elaborate a little bit on the "non Net parts of your program".

    Thank you for the regasm liknk, and for your help.

    Jzeznus

    Wednesday, June 2, 2010 8:29 PM
  • You're using an ActiveX or COM component in your project but it isn't registered on your Vista machine or you are missing the interop assembly (which should be in the bin folder).

    You may want to indicate which COM components you are using (check your References list).

    or...

    The problem could also be that you're running a 64-bit version of the OS. In which case you may need to compile your app for 32-bit only (Build...Configuration Manager...Platform...x86) in order to load 32-bit COM components.


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Wednesday, June 2, 2010 9:15 PM
  • Thank You Cor and Paul,

    I now have the problem solved because of your inputs.

    Jzeznus

    • Proposed as answer by hjxlpp Wednesday, November 28, 2012 3:21 AM
    Monday, June 7, 2010 10:36 PM
  • Thanks, nice inputs. I just new to vb2008 with different OS version on client computers and moving forward to windows 7.
    Monday, March 21, 2011 6:58 AM
  • I was having the same problem with the AxAcroPDFLib and all it took to solve this problem was too add the import statements for every library onto every form, even if the program does not mark an error for not having the import statement, you NEED to add the import statements for every library in every form. 

     

    Hope this helps and have fun

     

    Friday, August 19, 2011 5:18 PM
  • Hi paul,

    I solved my application problem.

    Thanks.

     

    Tuesday, September 13, 2011 9:07 AM
  • hi Guys,

    Can you please tell me how you solved this issue step by step its very urgent for me.

    Thursday, November 22, 2012 6:03 AM
  • It really helped us while migrating from 32 bit to 64 bit  platform
    Wednesday, September 18, 2013 8:04 AM
  • I have the Answer   

    Edit:  On the "Settings" submenu of the "Tools" menu, select "Expert settings" 

    1.  On the "Tools" menu, click "Options".

    2.  Check "Show all settings".

    3.  Expand "Projects and Solutions and click General".

    4.  Check "Show advanced build configurations".

    5.  Click "OK"

    6.  On the "Build" click "Configuration Manager...".  (Add it if it isn't there)

    7.  In the "Acitve solution platform:" drop down, click "<New...>".

    8.  In the "Type or select the new platform:" drop down, click "x86".

    9.  Click "OK".

    10.  Click "Close".

    11.  Build the project.

    Then when you generate the .exe use the \bin\x86\Release inside 

    its working

    Friday, June 13, 2014 2:15 PM