I'm trying to use in vb.net a function and an interface created in c#. The function is RegisterDragDrop and the interface is IDropTarget:
the second parameter points to an IDropTarget interface.
I'm implementing this interface in vb.net as follows:
When I create an instance of myDrop I get an InvalidCastException. So how can I pass this interface implementation as a parameter to the function RegisterDragDrop?
VB.NET:
Public Shared Function RegisterDragDrop(ByVal hwnd As System.IntPtr, ByVal pDropTarget As GongSolutions.Shell.Interop.IDropTarget) As Integer
the second parameter points to an IDropTarget interface.
I'm implementing this interface in vb.net as follows:
VB.NET:
Public Class myDrop
Implements IDropTarget
Public Sub Init(ByVal list As ListView)
GongSolutions.Shell.Interop.Ole32.RegisterDragDrop(list.Handle, Me) <--- Me is wrong ¿?
End Sub
Public Sub OnDragDrop(ByVal e As System.Windows.Forms.DragEventArgs) Implements System.Windows.Forms.IDropTarget.OnDragDrop
End Sub
End Class
When I create an instance of myDrop I get an InvalidCastException. So how can I pass this interface implementation as a parameter to the function RegisterDragDrop?