By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,168 Members | 2,598 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,168 IT Pros & Developers. It's quick & easy.

Pick file with mouseclick on desktop and display name in textbox

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

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
  2.     Me.AllowDrop = True
  3. End Sub
  4.  
  5. Private Sub Form1_DragDrop(sender As System.Object, e As System.Windows.Forms.DragEventArgs) Handles Me.DragDrop
  6.     Dim files() As String = e.Data.GetData(DataFormats.FileDrop)
  7.     For Each path In files
  8.         MsgBox(path)
  9.     Next
  10. End Sub
  11.  
  12. Private Sub Form1_DragEnter(sender As System.Object, e As System.Windows.Forms.DragEventArgs) Handles Me.DragEnter
  13.     If e.Data.GetDataPresent(DataFormats.FileDrop) Then
  14.         e.Effect = DragDropEffects.Copy
  15.     End If
  16. End Sub
Mar 17 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.