CodeItBetter Programming Another VB Programming Blog

How to Drag controls even at Runtime

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'Controls - How to Drag controls even at Runtime
Option Explicit
 
'Open a new project and insert a command button and insert the following code and
'try dragging the command button at run time

Private Sub Form_Activate()
    Command1.DragMode = vbAutomatic
End Sub
 
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
    If TypeOf Source Is CommandButton Then
        Command1.Left = X
        Command1.Top = Y
    End If
End Sub
Filed under: Controls Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.