PDA

Click to See Complete Forum and Search --> : VB - Move a control around the form


Mushroom Realm
Feb 19th, 2003, 05:00 PM
'This example uses the a Textbox named Text1
Dim tmpX as Integer
Dim tmpY as Integer
Dim Down as Byte
Private Sub Text1_MouseDown(X as Integer, Y as Integer)
tmpX = X
tmpY = Y
Down = 1
End Sub
Private Sub Text1_MouseMove(X as Integer, Y as Integer)
If Down = 1 Then
Text1.Left = Text1.Left + (X - tmpX)
Text1.Top = Text1.Top + (Y - tmpY)
EndIf
End Sub
Private Sub Text1_MouseUp(X as Integer, Y as Integer)
Down = 0
End Sub