Click here to Skip to main content
15,919,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to drag and drop multiple textboxes at runtime to a frame which is placed on form.
i am move drag or drop only one control at a time. but i want that multiple controls has to drag and drop at a time

this is code iam using for moving single controls

VB
Dim cordinates As Point
   Dim i As Integer
   Dim cbCount As Integer
   Private Sub Control_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) 'Handles Button1.MouseDown
       cordinates = New Point(-e.X, -e.Y)  'Holds controls X Y Coordinates while mouse is down
   End Sub
   Private Sub Control_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) ' Handles Button1.MouseMove

       If e.Button = Windows.Forms.MouseButtons.Left Then
           Dim ControlPosition As Point = Me.PointToClient(MousePosition)
           ControlPosition.Offset(cordinates.X, cordinates.Y)
           sender.Location = ControlPosition
       End If
   End Sub
Posted

1 solution

You'd have to write a container control that supports doing this. You'd add each selected control to a collection, treating the collection as a single control, then move the collection around.
 
Share this answer
 
Comments
sameertm 31-Oct-10 9:19am    
can u show some example coding for that pls

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900