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

Drap Drop Question

P: n/a
Does anyone have some sample code that would show me how to drag and
..doc or exe file to a drop target and then extract the file path on
drop?

Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Here is something I did which places dropped items in a CheckListBox. The
code is more or less a copy from a webpage (don't remember were from).

Private Sub Form1_DragEnter(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles MyBase.DragEnter
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.Copy
End If
End Sub

Private Sub Form1_DragDrop(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles MyBase.DragDrop
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
Dim draggedFiles As String() =
CType(e.Data.GetData(DataFormats.FileDrop), String())
For Each strFileName As String In draggedFiles
With ListBox1
.Items.Add(strFileName)
.SetSelected(.Items.Count - 1, True)
.SetItemChecked(.SelectedIndex, True)
End With
Next
Me.ActiveControl = ListBox1
End If
End Sub

Hope this helps you.

"pmclinn" <pe***@mclinn.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Does anyone have some sample code that would show me how to drag and
.doc or exe file to a drop target and then extract the file path on
drop?

Nov 21 '05 #2

P: n/a
"pmclinn" <pe***@mclinn.com> schrieb:
Does anyone have some sample code that would show me how to drag and
.doc or exe file to a drop target and then extract the file path on
drop?


See:

<URL:http://www.google.de/groups?selm=Oc8PBhAfDHA.1212%40TK2MSFTNGP12.phx.gb l>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.