Hi

I have a class with a event

Code:
Public Class MyClass
 
    Public Event MyEvent(ByVal Argument As String)
 
    Private Sub Whatever()
       RaiseEvent MyEvent("My Argument")
    end sub
 
End Class
This works fine if i have only one instance of that class.
The problem is that when i have more than one instance of this class like this:

Code:
Private Sub IwDataGrid1_CellDoubleClick(ByVal Argument As String) Handles MyClassInstance1.MyEvent
    MsgBox(Argument )
End Sub
 
Private Sub IwDataGrid2_CellDoubleClick(ByVal Argument As String) Handles MyClassInstance2.MyEvent
    MsgBox(Argument )
End Sub
the .NET frameworks triggers a "System.NullReferenceException"

I would be gratefull if someone could explain me why this happens and how can i solve this problem!