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:
- How to create Controls in a form runtime (without creating in design time)
- How to allow Controls to move
- How to Enable/Disable all Controls in a frame
- How to implement Drag and Drop in TreeView Control
- How to enable the user to drag and drop items between two list boxes
- How to Dynamically create controls at runtime using Controls.Add and place them in a scrolled window
- How to Drag/drop files from explorer to a listbox
- How to access Controls by their Names as text
- How to Drag/Move items from one List Box to another List Box
- How to add nodes to a Treeview at runtime