MSDN Library

Visual Basic Reference

DragMode Property Example

This example enables and disables the ability to drag a CommandButton control each time a form is clicked. To try this example, paste the code into the Declarations section of a form that contains a CommandButton, and then press F5 and click the form.

Private Sub Form_Click ()
 ' Check DragMode.
   If Command1.DragMode = vbManual Then   
      ' Turn it on.
  Command1.DragMode = vbAutomatic
   Else
      ' Or turn it off.
     Command1.DragMode = vbManual
   End If
End Sub
Show:
© 2016 Microsoft