80070002 error when interoperating with COM event sink

J

jennyq

hi all,
I am just playing with the event sink sample on MSDN, but I found when I
create the instance in VB client, there is an error saying "method
'myButton' of object 'form1'failed, errorcode is 8007002. I don't know how
to fix it so far.

The sample is
http://msdn.microsoft.com/library/d...e/html/cpconraisingeventshandledbycomsink.asp
I use the c# sample

1) I specified a key file for the library
2) I used regasm and gacutil to export/register the typelib and intall it
into GAC
3) My VB code is almost the same as the sample except I added From_Load, in
which class_initialize is called(actually I am not sure whether this is
right way to do it because of my poor VB knowledge).

Any help are appreciated!

Qiu
 
J

jennyq

Thanks very much!
Your answer just reminds me that my dll is strong named, so I should use
full name of the assembly.
The error msg Vb reported just made me totally lost.

Mattias Sjögren said:
I am just playing with the event sink sample on MSDN, but I found when I
create the instance in VB client, there is an error saying "method
'myButton' of object 'form1'failed, errorcode is 8007002. I don't know how
to fix it so far.

That's basicly a "File not found" error.

See if it helps to change

[ComSourceInterfaces("EventSource.ButtonEvents, EventSrc")]

to

[ComSourceInterfaces(typeof(ButtonEvents))]

3) My VB code is almost the same as the sample except I added From_Load, in
which class_initialize is called(actually I am not sure whether this is
right way to do it because of my poor VB knowledge).

No you shouldn't call Class_Initialize manually. It's like a
constructor, and is called automatically whenever an instance of the
class is created.



Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top