Hi All,
I have been trying to use drag and drop to move a button from one flowlayoutpanel to another but have decided this will not work as I have to create a new button dynamically (as far as i can see) so the click event gets lost.
How would you go about moving a button from one panel to another? (flowlayoutpanels) also I would love to be able to change the order in the same panel just by dragging.
the code I had so far is:
I have been trying to use drag and drop to move a button from one flowlayoutpanel to another but have decided this will not work as I have to create a new button dynamically (as far as i can see) so the click event gets lost.
How would you go about moving a button from one panel to another? (flowlayoutpanels) also I would love to be able to change the order in the same panel just by dragging.
the code I had so far is:
Code:
dim asd as control
dim butt1 as boolean
Private Sub Button15_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Button15.MouseDown
butt1 = True
End Sub
Private Sub Button15_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Button15.MouseMove
asd = sender
If butt1 = True Then
DoDragDrop(Button15, DragDropEffects.Move)
End If
End Sub
Private Sub Button15_MouseUp(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Button15.MouseUp
butt1 = False
End Sub
Private Sub FlowLayoutPanel2_DragDrop(sender As Object, e As System.Windows.Forms.DragEventArgs) Handles FlowLayoutPanel2.DragDrop
FlowLayoutPanel1.Controls.Remove(asd)
FlowLayoutPanel2.Controls.Add(asd)
End Sub