Error occured when i am using com objects

Hi all,
First of all thanx to read this.

I have created a VB dll and it is registered into my local machine.
I am using this dll and all classess and methods into my .net application;

Exception Details:System.InvalidCastException: QueryInterface for interface testdll._Class1 failed.
Line 25: Dim vb6_class As New testdll.Class1Class() Line 26:Line 27: TextBox1.Text = CInt(vb6_class.Hi)Line 28:

VBCode
Public Function Hi() As Integer

Hi = 44

End Function
can u provide solution for this and some guide line about COM objects.

[745 byte] By [MaheshPrajapati] at [2007-12-16]
# 1
Hi,

Try if you can directly instantiate the class using the ProgId without using the Interop Class.

The GetTypeFromProgID methods on System.Type have
can provide u the type and then you then pass the
returned Type to System.Activator.CreateInstanc­e to instantiate the
COM object.

Regards,
Vikram

Vikram at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified