470,590 Members | 2,161 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,590 developers. It's quick & easy.

How can I support the dragging and dropping of supported documents onto my form?

Hi Gang,
I would like to be able to drag and drop documents onto my application and
have them open immediately thereafter. Can somebody point me towards a KB
article or example? I could find a lot of examples pertaining to dragging
and dropping objects within a form, but nothing about dragging external
documents over a form.
Thanks in Advance,
Christian Blackburn
Nov 20 '05 #1
2 1317
"Christian Blackburn" <Christian@Damn@Sp**@Hotmail.com> schrieb
I would like to be able to drag and drop documents onto my
application and have them open immediately thereafter. Can somebody
point me towards a KB article or example? I could find a lot of
examples pertaining to dragging and dropping objects within a form,
but nothing about dragging external documents over a form.

Don't know if you've already read:

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB/vbcon/html/vbcondragdropclipboards
upport.htm

(see hints in signature)

--
Armin

- Links might be split into two lines. Concatenate them using notepad.
- Links might require to add a ".nnnn" after the "2003FEB", e.g.
"2003FEB.1033" for localized versions.
- Links starting with "ms-help" are URLs for the document explorer (<F1>).
Paste them in the URL textbox and press enter. Using internal help (menu
tools -> options -> environment -> help), display the "Web" toolbar that
contains the textbox.

Nov 20 '05 #2
Dude, it almost the same thing as dragging and dropping internat objects.
What you need to do is get the dragged object as a FileDrop:

on your DragEnter handler:
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
'this is a file
e.Effect = DragDropEffects.Copy
else
e.Effect = DargDropEffects.None
End If

on your DragDrop handler:

Dim data as Object = e.Data.GetData(DataFormats.FileDrop)
Dim fileList() as object = CType(data, object())
Dim fileName as string
For Each fileName in fileList
'do whatever you need to do with the file name
Next

There are probably some syntax errors above but you get the idea.

HTH

TJ!

"Christian Blackburn" <Christian@Damn@Sp**@Hotmail.com> wrote in message
news:eU*************@TK2MSFTNGP12.phx.gbl...
Hi Gang,
I would like to be able to drag and drop documents onto my application and
have them open immediately thereafter. Can somebody point me towards a KB
article or example? I could find a lot of examples pertaining to dragging
and dropping objects within a form, but nothing about dragging external
documents over a form.
Thanks in Advance,
Christian Blackburn

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by code_wrong | last post: by
reply views Thread by James Slade | last post: by
14 posts views Thread by Anoop | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.