CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Sep 2011

    Implementing a c# interface that has an event through COM

    I have a VB6 class that needs to implement an interface which I created in C#. I have been able to succesfully implement all of the properties of the interface in my vb6 class over COM, but have not been able to implement the event that it has. If I understand correctly, I will need to have the equivilant of the add and remove accessors defined to regester consumers of the event, but I cannot get VB6 to accept the interface with the event defined. I am setting the InterfaceType of the class to InterfaceIsIDispatch, but still get the error "Bad interface for Implements: method has underscore in name" when I try to compile. The interface does not define any methods, and neither the properties nor the event have any underscores.

  2. #2
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008

    Re: Implementing a c# interface that has an event through COM

    As a general rule you should nto use underscores in var, property nor function names. I know VB6 does it but MS says not to in the .net languages and code in general.

    Edit: I think maybe I missunderstood the post, after reading again sounds like you are saying it is a bogus message about underscores?
    Always use [code][/code] tags when posting code.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.