Pick file with mouseclick on desktop and display name in textbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • carel5103
    New Member
    • Mar 2013
    • 1

    Pick file with mouseclick on desktop and display name in textbox

    I want to do the same as this but instead of drag and drop, I want to do it with left mouse_click

    Code:
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Me.AllowDrop = True
    End Sub
    
    Private Sub Form1_DragDrop(sender As System.Object, e As System.Windows.Forms.DragEventArgs) Handles Me.DragDrop
        Dim files() As String = e.Data.GetData(DataFormats.FileDrop)
        For Each path In files
            MsgBox(path)
        Next
    End Sub
    
    Private Sub Form1_DragEnter(sender As System.Object, e As System.Windows.Forms.DragEventArgs) Handles Me.DragEnter
        If e.Data.GetDataPresent(DataFormats.FileDrop) Then
            e.Effect = DragDropEffects.Copy
        End If
    End Sub
    Last edited by Rabbit; Mar 18 '13, 04:49 PM. Reason: Please use code tags when posting code.
Working...