Hi Martin,
Here I write a sample about how to expose the event of .NET component to
VB6.
[TestComObject.Class1]
Imports System.Runtime.InteropServices
Public Delegate Sub testdelegate()
<GuidAttribute("1F98211C-7A71-4588-8D4A-AD85CA80BAE7"), _
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)> _
Public Interface ControlEvents
<DispIdAttribute(1)> _
Sub testevent()
End Interface
<ComSourceInterfaces(GetType(ControlEvents)),
ClassInterface(ClassInterfaceType.AutoDual)> _
Public Class Class1
Dim WithEvents fm As Form1
Public Sub test()
fm = New Form1
fm.Show()
End Sub
Public Event testevent()
Private Sub fm_Closed(ByVal sender As Object, ByVal e As
System.EventArgs) Handles fm.Closed
RaiseEvent testevent()
End Sub
End Class
[VB6 code]
Dim WithEvents o As TestComObject.Class1
Private Sub Command1_Click()
Set o = New TestComObject.Class1
o.test
End Sub
Private Sub o_testevent()
MsgBox "event fired"
End Sub
HOW TO: Sink Managed Visual Basic .NET Events in Internet Explorer Script
http://support.microsoft.com/?kbid=316516
Exposing .NET Framework Components to COM
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconexposingnetframeworkcomponentstocom.asp
If you have any concern please post here.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure!
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.