raising a vb6 event using interop
Posted
by Steve
on Stack Overflow
See other posts from Stack Overflow
or by Steve
Published on 2009-03-16T19:04:18Z
Indexed on
2010/04/04
1:53 UTC
Read the original article
Hit count: 448
Hi, I have a legacy VB6 component that I've imported into VS using tlbimp.exe to generate my interop assembly. The VB6 component defines an event that allows me to pass messages within VB6.
Public Event Message(ByVal iMsg As Variant, oCancel As Variant)
I would really like to be able to raise this even in my C# program, but its getting imported as an event, not a delegate or something else useful. So, I can only listen, but never fire. Does anyone know how to fire an event contained within VB6? The C# event looks like
[TypeLibType(16)]
[ComVisible(false)]
public interface __MyObj_Event
{
event __MyObj_MessageEventHandler Message;
}
I unfortunately cannot change the VB6 code. Thanks.
© Stack Overflow or respective owner