This should do it
<<<<<<code>>>>>>
Private dragging As Boolean
Private beginX, beginY As Integer
Private Sub Button2_MouseDown(ByVal sender As Object, ByVal e As _
System.Windows.Forms.MouseEventArgs) Handles Button2.MouseDown
dragging = True
beginX = e.X
beginY = e.Y
End Sub
Private Sub Button2_MouseMove(ByVal sender As Object, ByVal e As _
System.Windows.Forms.MouseEventArgs) Handles Button2.MouseMove
If dragging = True Then
Button2.Location = New Point(Button2.Location.X + e.X -
beginX,Button2.Location.Y + e.Y - beginY)
Me.Refresh()
End If
End Sub
Private Sub Button2_MouseUp(ByVal sender As Object, ByVal e As _
System.Windows.Forms.MouseEventArgs) Handles Button2.MouseUp
dragging = False
End Sub
<<<<<<code>>>>>>>
hth Peter
"Sakharam Phapale" <sp******@annetsite.com> wrote in message
news:Ox**************@TK2MSFTNGP09.phx.gbl...
Hi All,
How to move the CommandButton control using mouse from one position to
other?
Is it possible using Drag, Drop events or I have to write my own code for
that?
I have set the "AllowDrop" property to true. But when I try to drag the
Button it doesn't move.
Any help will be appreciated.
Thanks and Regards
Sakharam Phapale