Error in VB 6.0 : Class not Registered. Looking for object with CLSID :{....}

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DKn
    New Member
    • Aug 2007
    • 53

    Error in VB 6.0 : Class not Registered. Looking for object with CLSID :{....}

    Hi ,

    I am having a .Net Activex control. I have done coding for COMRegistering and Unregistereing in C#.Net. The code is follows..
    [ComRegisterFunc tion]
    static void ComRegister(Typ e t)
    {
    string keyName = @"CLSID\" + t.GUID.ToString ("B");
    using (RegistryKey key =
    Registry.Classe sRoot.OpenSubKe y(keyName, true))
    {
    key.CreateSubKe y("Control").Cl ose();
    using (RegistryKey subkey = key.CreateSubKe y("MiscStatus") )
    {
    subkey.SetValue ("", "131457");
    }
    using (RegistryKey subkey = key.CreateSubKe y("TypeLib"))
    {
    Guid libid = Marshal.GetType LibGuidForAssem bly(t.Assembly) ;
    subkey.SetValue ("", libid.ToString( "B"));
    }
    using (RegistryKey subkey = key.CreateSubKe y("Version"))
    {
    Version ver = t.Assembly.GetN ame().Version;
    string version =
    string.Format(" {0}.{1}",
    ver.Major,
    ver.Minor);
    if (version == "0.0") version = "1.0";
    subkey.SetValue ("", version);
    }
    }
    }

    [ComUnregisterFu nction]
    static void ComUnregister(T ype t)
    {
    // Delete entire CLSID\{clsid} subtree
    string keyName = @"CLSID\" + t.GUID.ToString ("B");
    Registry.Classe sRoot.DeleteSub KeyTree(keyName );
    }

    When i Build this .Net project this control is getting registering in the registry and i am able to add this .net control in vb 6.0 form also. its working fine.

    I want to test this dll on any other system other than developer machine....
    Then i tried to register this dll through Regasm.. The control is registered succefully. but when i tried to add this control in to vb 6.0 form.. I am getting this error: Class not Registered .Looking for Object with ClsId :{...}..

    Then i send full .net project to that system and build the .net appliaction. then it is registered fine and working fine in vb 6.0 also.. the problem is comming if i registered that dll through command line.. what is the solution for this...

    Plz Help ....
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Try to register the DLL using REGSVR32 .

    Comment

    • DKn
      New Member
      • Aug 2007
      • 53

      #3
      Originally posted by debasisdas
      Try to register the DLL using REGSVR32 .
      Yes i have done that .
      .NET commandPrompt, i run the Command regsvr32 MyDotNetControl .dll.
      error :MyDotNelContro l.dll was loaded, but the DllRegisterServ er Entry point was not found. the file can not be registered.

      Comment

      • QVeen72
        Recognized Expert Top Contributor
        • Oct 2006
        • 1445

        #4
        Hi,

        If you want to use the .net dll in VB6,
        While registering with regasm, you have to generate the "TypeLibrar y" :

        [code=vb]
        regasm myAssembly.dll /tlb:myAssembly. tlb
        [/code]

        OR, if you have already registered(With out Type Library),
        you can LateBind the Objects in VB6:
        [code=vb]
        Dim tObj As Object
        Set tObj = CreateObject("M yProjName.MyCla ssName")
        [/code]


        Regards
        Veena

        Comment

        • DKn
          New Member
          • Aug 2007
          • 53

          #5
          Hi,
          When i build my .net Project , both dll and tlb files are getting generated in bin debug folder.

          I have tried this code in vb 6.0

          Private Sub Form_Load()
          Dim Obj As VBControlExtend er
          Set Obj = Form1.Controls. Add("MyProjName .MyClassName")
          Obj.Visible = True

          End Sub

          Getting run time error: Class not registered.Look ing for object with CLSID{....}
          Is there any other solution....


          Originally posted by QVeen72
          Hi,

          If you want to use the .net dll in VB6,
          While registering with regasm, you have to generate the "TypeLibrar y" :

          [code=vb]
          regasm myAssembly.dll /tlb:myAssembly. tlb
          [/code]

          OR, if you have already registered(With out Type Library),
          you can LateBind the Objects in VB6:
          [code=vb]
          Dim tObj As Object
          Set tObj = CreateObject("M yProjName.MyCla ssName")
          [/code]


          Regards
          Veena

          Comment

          • QVeen72
            Recognized Expert Top Contributor
            • Oct 2006
            • 1445

            #6
            Hi,

            its an ActiveX Dll or an ActiveX ocx..?
            My previous code was for ActiveX Dll

            If ActiveX ocx, then remove the code,
            add the Control to the project
            and from toolbox, directly place the Control on the Form..

            Regards
            Veena

            Comment

            • DKn
              New Member
              • Aug 2007
              • 53

              #7
              Its .Net ActiveX Control.. when i drag and drop to the vb 6.0 form.. the same error...Class not registered.Look ing for object with clsid :{...} is coming..

              Comment

              • DKn
                New Member
                • Aug 2007
                • 53

                #8
                Hi,
                If I register through .Net code... In the registry Editor, the control is registered with the GUID under classRoot . InProcServer32 CodeBase Entry is coming.
                When I registered through Regasm this entry (codeBase value) is not there under InProcServer32. This is the only difference I observed....

                Is this is the Reason, I am getting the error : Class not registered. Looking for object with clsid :{...}

                Please anybody help me...

                Originally posted by DKn
                Its .Net ActiveX Control.. when i drag and drop to the vb 6.0 form.. the same error...Class not registered.Look ing for object with clsid :{...} is coming..
                Last edited by Killer42; Jan 15 '08, 08:18 AM. Reason: Corrected "defference"

                Comment

                • Killer42
                  Recognized Expert Expert
                  • Oct 2006
                  • 8429

                  #9
                  I suspect the .Net forum would provide a better response to this question.

                  Comment

                  • DKn
                    New Member
                    • Aug 2007
                    • 53

                    #10
                    Hi, i got the solution for this problem...
                    We need to Use this command..
                    Regasm /codebase myDotNetControl .dll
                    Now its working fine in other systems also..
                    But, the .Net dll must be strong named to use the Codebase command.....

                    Originally posted by Killer42
                    I suspect the .Net forum would provide a better response to this question.

                    Comment

                    Working...