GroupBox - DragDrop Question
hi guys,
I tried to create a sime drag-drop on my group box but it seems not working at the moment. AllowDrop=True already. What's wrong on my code ?
Code:
Private Sub gb_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles gb.DragDrop
Dim DropGB As GroupBox = CType((e.Data.GetData(GetType(GroupBox))), GroupBox)
Me.gb.Controls.Add(DropGB)
End Sub
Private Sub gb_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles gb.DragEnter
If e.Data.GetDataPresent(GetType(GroupBox)) Then
e.Effect = DragDropEffects.Move
Else
e.Effect = DragDropEffects.None
End If
End Sub
Private Sub gb_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gb.MouseDown
Me.gb.DoDragDrop(Me.gb, DragDropEffects.All)
End Sub
Thank you.
Re: GroupBox - DragDrop Question
How can you drag a GroupBox and drop it on itself? That doesn't make sense. What data are you trying to drag, where are you trying to drag it from and where are you trying to drop it.
Re: GroupBox - DragDrop Question
am just trying to drag the GB on the same form but different location.
Re: GroupBox - DragDrop Question
That wouldn't be a DragDrop operation. What you want to do is simply move the control. Search the forum for movable controls or similar search terms.