Created
July 8, 2014 03:17
-
-
Save jdforsythe/a4b5481f7bc0cce20e1c to your computer and use it in GitHub Desktop.
VB.net drag drop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Class uiFrmDragDropTest | |
Private Sub uiFrmDragDropTest_Load(sender As Object, e As EventArgs) Handles MyBase.Load | |
' Me.AllowDrop = True | |
' TextBox1.AllowDrop = True | |
End Sub | |
'' form drag-drop | |
Private Sub uiFrmDragDropTest_DragEnter(sender As Object, e As DragEventArgs) Handles Me.DragEnter | |
If (e.Data.GetDataPresent(DataFormats.FileDrop)) Then | |
e.Effect = DragDropEffects.Copy | |
End If | |
End Sub | |
Private Sub uiFrmDragDropTest_DragDrop(sender As Object, e As DragEventArgs) Handles Me.DragDrop | |
Dim files() As String = e.Data.GetData(DataFormats.FileDrop) | |
For Each path In files | |
TextBox1.Text &= vbCrLf & path | |
Next | |
End Sub | |
'' textbox drag-drop | |
Private Sub TextBox1_DragEnter(sender As Object, e As DragEventArgs) Handles TextBox1.DragEnter | |
If (e.Data.GetDataPresent(DataFormats.FileDrop)) Then | |
e.Effect = DragDropEffects.Copy | |
End If | |
End Sub | |
Private Sub TextBox1_DragDrop(sender As Object, e As DragEventArgs) Handles TextBox1.DragDrop | |
Dim files() As String = e.Data.GetData(DataFormats.FileDrop) | |
For Each path In files | |
TextBox1.Text &= vbCrLf & path | |
Next | |
End Sub | |
End Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment