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 equivalent of the add and remove accessors defined to register 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.
Here is the interface definition
namespace AV8B.Overlay
{
[ComVisible(true)]
[Guid("89519DCE-86D6-4962-8CEA-450F2AB31B4E")]
public delegate void OverlaySymbolPropertyChangedEventHandler(object sender, OverlaySymbolPropertyChangedEventArgs e);
[ComVisible(true)]
[Guid("9A59EF10-B688-4af9-8C21-FB95C7ED699A")]
public class OverlaySymbolPropertyChangedEventArgs : PropertyChangedEventArgs
{
OverlaySymbolPropertyChangedEventArgs(string propertyName) : base(propertyName) { }
}
[ComVisible(true)]
[Guid("379B179C-85FA-4efb-8198-D1A4C80D645A")]
public interface IOverlaySymbol : INotifyPropertyChanged
{
bool SelectedForProcessing { get; set; }
int SymbolNumber { get; }
string SymbolType { get; }
double Latitude { get; }
double Longitude { get; }
string Color { get; }
int Size { get; }
/// <summary>
/// This method fires the PropertyChanged event.
/// </summary>
void NotifyPropertyChanged();
/// <summary>
/// The event that fires when a property changes.
/// </summary>
new event OverlaySymbolPropertyChangedEventHandler PropertyChanged;
}
}
The goal behind this is to place existing VB objects that implement this interface into a binding list which will be attached to a list grid view. The list grid view needs to know when the properties of its items change so it can update accordingly.