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

Related posts:

  1. How to create Controls in a form runtime (without creating in design time)
  2. How to allow Controls to move
  3. How to Enable/Disable all Controls in a frame
  4. How to implement Drag and Drop in TreeView Control
  5. How to enable the user to drag and drop items between two list boxes
  6. How to Dynamically create controls at runtime using Controls.Add and place them in a scrolled window
  7. How to Drag/drop files from explorer to a listbox
  8. How to access Controls by their Names as text
  9. How to Drag/Move items from one List Box to another List Box
  10. How to add nodes to a Treeview at runtime

Filed under: Controls Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.