1

I get a compile error "object does not source automation events" on this line in VB6:

Private WithEvents obj As MyClass

MyClass is a COM-visible .NET class.

What is the cause of this error?

2
  • I don't know the cause of that, but: it must be observed that VB6 is 4 years into an afterlife... Is this question addressed here: stackoverflow.com/questions/881305/…? Commented Sep 2, 2012 at 5:46
  • 4
    This means there are no events (source interface) defined for MyClass coclass. @Marc: It must be observed that there are still questions being asked about VB6. FORTRAN too. Commented Sep 2, 2012 at 9:05

1 Answer 1

2

It means that MyClass does not have any public events (accessible via COM Interop).

If the .NET object was created in VB.Net, you can use the standard Event keyword as with VB6. C# will require the event keyword and an associated delegate. COM Interop will handle the conversion between .NET events and COM events.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.