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

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

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
"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

P: n/a
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.