Skip to content

Instantly share code, notes, and snippets.

@orellabac
Last active August 10, 2016 18:11
Show Gist options
  • Save orellabac/25957ce2060ef3d550e425bba88e3dc8 to your computer and use it in GitHub Desktop.
Save orellabac/25957ce2060ef3d550e425bba88e3dc8 to your computer and use it in GitHub Desktop.
VERSION 5.00
Begin VB.Form Form1
Caption = "Drag and Drop"
ClientHeight = 3195
ClientLeft = 6180
ClientTop = 5730
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
Begin VB.CommandButton Command1
Caption = "Quit"
Height = 495
Left = 360
TabIndex = 2
Top = 2280
Width = 3975
End
Begin VB.TextBox Text1
DragIcon = "DragDrop.frx":0000
Height = 375
Left = 360
TabIndex = 1
Text = "Drag me to the label!"
Top = 1440
Width = 3975
End
Begin VB.Label Label1
Caption = "Label1"
Height = 255
Left = 360
TabIndex = 0
Top = 360
Width = 3975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
End Sub
Private Sub Label1_DragDrop(Source As Control, X As Single, Y As Single)
Label1.Caption = Source.Text
End Sub
Private Sub Label1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
End Sub
Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Len(Text1.Text) > 0 And Button = 1 Then
Text1.Drag vbBeginDrag
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment