Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27353

drag and drop

$
0
0
Hi All,

I have never used drag and drop before and am wanting to do the following.
I have 2 flowlayoutpanels in which 8 buttons can sit in. i want the user to be able to drag the buttons between each panel and be able to rearrange the order they are in.

I can get them to move between each other (however it does happen slowly) but if I try and move the order within the same panel I get the buttons playing up and no idea why. below is a sample of the code for one button

any soloutions or advise much appriciated

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


Viewing all articles
Browse latest Browse all 27353

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>