Hi, I have a program where i am trying to drag and drop controls within a table layout panel. I have normal controls created at runtime now and i assign a custom event handler to them:
i then have the table layout panels (some creted at runtime and some at design time) and give them these event handlers
The Drag enter function gets called, however If e.Data.GetData(GetType(Control)) always returns false, don't know why.
the main problem though is the dragdrop function is never called in the whole program, i don't know why, i have been through pages of examples on google and i seem to be doing exactly as they do but mines doesnt work.
anyone know why?
PHP:
Private Sub custom_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim con As Control = DirectCast(sender, Control)
con.DoDragDrop(con, DragDropEffects.Copy)
End Sub
PHP:
Private Sub custom_DragEnter(ByVal sender As Object, ByVal e As DragEventArgs)
If e.Data.GetData(GetType(Control)) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub
Private Sub custom_DragDrop(ByVal sender As Object, ByVal e As DragEventArgs)
Dim con As Control = DirectCast(e.Data.GetData(GetType(Control)), Control)
MsgBox("pos = " & con.Location.X.ToString)
End Sub
the main problem though is the dragdrop function is never called in the whole program, i don't know why, i have been through pages of examples on google and i seem to be doing exactly as they do but mines doesnt work.
anyone know why?