|
|
|
This code will show you how simple it is to get file/folder list dragged from explorer.
Step-By-Step Example
- Create a Windows Application - Add one ListBox control on the form - Add the following code in form1 - Run the project and try to drag and drop some files into listbox from explore |
Click here to copy the following block | Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load
ListBox1.AllowDrop = True End Sub
Private Sub ListBox1_DragEnter(ByVal sender As Object, _ ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox1.DragEnter If e.Data.GetDataPresent(DataFormats.FileDrop) Then e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.None End If End Sub
Private Sub ListBox1_DragDrop(ByVal sender As Object, _ ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox1.DragDrop
Dim strFiles() As String Dim i As Long
strFiles = e.Data.GetData(DataFormats.FileDrop)
For i = 0 To strFiles.GetUpperBound(0) ListBox1.Items.Add(strFiles(i)) Next End Sub |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|