By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,117 Members | 1,714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,117 IT Pros & Developers. It's quick & easy.

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

P: 53
Hi ,

I am having a .Net Activex control. I have done coding for COMRegistering and Unregistereing in C#.Net. The code is follows..
[ComRegisterFunction]
static void ComRegister(Type t)
{
string keyName = @"CLSID\" + t.GUID.ToString("B");
using (RegistryKey key =
Registry.ClassesRoot.OpenSubKey(keyName, true))
{
key.CreateSubKey("Control").Close();
using (RegistryKey subkey = key.CreateSubKey("MiscStatus"))
{
subkey.SetValue("", "131457");
}
using (RegistryKey subkey = key.CreateSubKey("TypeLib"))
{
Guid libid = Marshal.GetTypeLibGuidForAssembly(t.Assembly);
subkey.SetValue("", libid.ToString("B"));
}
using (RegistryKey subkey = key.CreateSubKey("Version"))
{
Version ver = t.Assembly.GetName().Version;
string version =
string.Format("{0}.{1}",
ver.Major,
ver.Minor);
if (version == "0.0") version = "1.0";
subkey.SetValue("", version);
}
}
}

[ComUnregisterFunction]
static void ComUnregister(Type t)
{
// Delete entire CLSID\{clsid} subtree
string keyName = @"CLSID\" + t.GUID.ToString("B");
Registry.ClassesRoot.DeleteSubKeyTree(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 ....
Jan 14 '08 #1
Share this Question
Share on Google+
9 Replies


debasisdas
Expert 5K+
P: 8,127
Try to register the DLL using REGSVR32 .
Jan 14 '08 #2

P: 53
DKn
Try to register the DLL using REGSVR32 .
Yes i have done that .
.NET commandPrompt, i run the Command regsvr32 MyDotNetControl.dll.
error :MyDotNelControl.dll was loaded, but the DllRegisterServer Entry point was not found. the file can not be registered.
Jan 14 '08 #3

QVeen72
Expert 100+
P: 1,445
Hi,

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

Expand|Select|Wrap|Line Numbers
  1. regasm myAssembly.dll  /tlb:myAssembly.tlb
  2.  
OR, if you have already registered(Without Type Library),
you can LateBind the Objects in VB6:
Expand|Select|Wrap|Line Numbers
  1. Dim tObj As Object
  2. Set tObj = CreateObject("MyProjName.MyClassName")
  3.  

Regards
Veena
Jan 14 '08 #4

P: 53
DKn
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 VBControlExtender
Set Obj = Form1.Controls.Add("MyProjName.MyClassName")
Obj.Visible = True

End Sub

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


Hi,

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

Expand|Select|Wrap|Line Numbers
  1. regasm myAssembly.dll  /tlb:myAssembly.tlb
  2.  
OR, if you have already registered(Without Type Library),
you can LateBind the Objects in VB6:
Expand|Select|Wrap|Line Numbers
  1. Dim tObj As Object
  2. Set tObj = CreateObject("MyProjName.MyClassName")
  3.  

Regards
Veena
Jan 14 '08 #5

QVeen72
Expert 100+
P: 1,445
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
Jan 14 '08 #6

P: 53
DKn
Its .Net ActiveX Control.. when i drag and drop to the vb 6.0 form.. the same error...Class not registered.Looking for object with clsid :{...} is coming..
Jan 14 '08 #7

P: 53
DKn
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...

Its .Net ActiveX Control.. when i drag and drop to the vb 6.0 form.. the same error...Class not registered.Looking for object with clsid :{...} is coming..
Jan 14 '08 #8

Expert 5K+
P: 8,434
I suspect the .Net forum would provide a better response to this question.
Jan 15 '08 #9

P: 53
DKn
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.....

I suspect the .Net forum would provide a better response to this question.
Jan 16 '08 #10

Post your reply

Sign in to post your reply or Sign up for a free account.