Hallo,
in einer Klasse, die ein Interface implementiert, würde ich gern ein Event auslösen und an das Interface weiter leiten, so dass der Aufrufer des Interfaces das Event erhält.
Leider bekomme ich es nicht hin, dass die Klasse (hier: MySQL) das Event an das Interface (hier: DBConnection) weiterleitet.
Kann mir da jemand weiter helfen?
Vielen Dank,
Gruß Jan
Anbei mal der Code, der so nicht klappt.
z.B. Ein Test
Private WithEvents dbc As DBConnection
Private con As ADODB.Connection
Public Sub Main()
Set dbc = New MySQL
Set con = dbc.getConnection()
End Sub
Private Sub dbc\_ConnectionError(c As DBConnection, e As String)
MsgBox ...
End Sub
Das Interface: DBConnection
Public Event ConnectionError(c As DbConnection, e As String)
Public Property Get getConnection() AS ADODB.Connection
End Property
Eine Klasse: MySQL
Implements DBConnection
Public Event ConnectionError(c As DbConnection, e As String)
Public Property Get DBConnection\_getConnection() AS ADODB.Connection
On Error Goto ERROR\_HANDLING
...
ERROR\_HANDLING:
RaiseEvent ConnectionError(Me, "Zugriff auf MySQL nicht möglich")
End Property