I have to be missing something simple, but my brain is about to bleed on this.
I have an interface, for the sake of argument called MyInterface.
I Have a Control Class, lets name it "Parent" that implements MyInterface.
I have another Control Class that inherits Parent, called "Child"
I have a final Control Class lets call it "Container", that accepts dragging the parent onto it.
The code in Container for Dragover is simple, like this:
Protected Overrides Sub OnDragOver(ByVal e As System.Windows.Forms.DragEventArgs)
If e.Data.GetDataPresent(GetType(Parent)) Then
e.Effect = DragDropEffects.Move
End If
MyBase.OnDragOver(e)
Refresh()
End Sub
I want to modify this not to only accept Parent, but to accept ANYthing that implements MyInterface. I can't figure out how the heck to get it to work.
Even more confusing, if I drag the child onto Container, with the code as it is above(checking to see if a Parent was dropped), GetDataPresent always returns false. I would figure it would work, since Child inherited parent.
Ideally, I would have something like this:
Protected Overrides Sub OnDragOver(ByVal e As System.Windows.Forms.DragEventArgs)
If e.Data.GetDataPresent(GetType(MyInterface)) Then
e.Effect = DragDropEffects.Move
End If
MyBase.OnDragOver(e)
Refresh()
End Sub
But it bombs and GetDataPresent returns false whether I dragged a Parent or a Child. I'm being an idiot somewhere...but I cont know where. Help?