I have created a DLL in VB.NET and loaded in VB6.
All variables and methods are working very well.
In the DLL, I have a RaiseEvent
.
The RaiseEvent
from .NET DLL cannot trigger the methods in VB6.
Option Explicit On
Option Strict On
Imports System.Windows.Forms
Imports System.Net.Sockets
Imports System.IO
Imports System.Text
Imports System.Net
Imports System.ComponentModel
Imports System.Threading
Imports System.Runtime.InteropServices
<ComClass(TestDLL.ClassId, TestDLL.InterfaceId, TestDLL.EventsId)>
Public Class TestDLL
Public Const ClassId As String = "6E9AB173-14BD-4DE4-9AE0-A9638FCE40B3"
Public Const InterfaceId As String = "E659D166-F952-489F-899F-0104553B44E4"
Public Const EventsId As String = "1C38AB4A-84B9-4CC2-A090-0C272177ECED"
Public Event Disconnected()
Public Event FirstConnect()
Public Event Waagerecht()
Private Sub Received(ByVal msg As String) Handles Me.Receive
RaiseEvent Waagerecht()
End Sub
This DLL is working in C#, VB.NET and in Labview amazing. Only not in VB6
RaiseEvent Part in VB.NET DLL
And the code in VB6:
Option Explicit
Private WithEvents MyNetClass As TestDll
Private Sub Form_Load()
Set MyNetClass = New TestDll
End Sub
Private Sub Form_Terminate()
Set MyNetClass = Nothing
End Sub
And the methods for triggering:
Private Sub MyNetClass_Waagerecht()
MsgBox "Ich werde angezeigt, sobald dll mir was sagt"
End Sub