I have 25 buttons in a form.
Here is the code below that i have used to change the location of One button at run time.
Now i want to Change the location of remaining 24 buttons.So, should i write this code for all those buttons or is there any easier way to do the same?
Could someone please help?
Here is the code below that i have used to change the location of One button at run time.
Code:
Public Class table
Private dragging As Boolean
Private beginX, beginY As Integer
Private Sub Button1_mousedown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown
dragging = True
beginX = e.X
beginY = e.Y
End Sub
Private Sub Button1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseMove
If dragging = True Then
Button1.Location = New Point(Button1.Location.X + e.X - beginX, Button1.Location.Y + e.Y - beginY)
Me.Refresh()
End If
End Sub
Private Sub Button1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseUp
dragging = False
End Sub
End Class
Could someone please help?
Comment