VB.NET - How to Drag a File From Outlook 2010 to My Form? -


i'm developing application read xml files, data , populate field. so, i've implemented 2 ways file: through command button , through drag , drop form event. ok if use file stored in folder in computer. can drag file, cursor changes appearance copy effect etc. however, when try doing dragging file attachment of outlook (my version 2010), see cursor assumes forbidden effect , file not read.

please, see below implementation did, working files stored in folder in computer. know more have implement allow drag file outlook.

thank in advance.

    private sub frmjig_dragdrop(sender object, e drageventargs) _     handles me.dragdrop     dim files() string = e.data.getdata(dataformats.filedrop)     dim filestype() string      filestype = e.data.getdata(dataformats.filedrop)     dim sreader new streamreader(filestype(0))      'get filename file without path     dim file_name string = path.getfilename(filestype(0))      'check extension of file     if path.getextension(filestype(0)).tolower() = ".xml"         'read xml file         each path in files             readxmlfile(path)         next     else          'warning file type         messagebox.show("only xml files supported!", "warning!", _ messageboxbuttons.ok, _     messageboxicon.warning)     end if end sub  private sub frmjig_dragenter(sender object, e drageventargs) _ handles me.dragenter      'change cursor  type drag , drop type     if e.data.getdatapresent(dataformats.filedrop)         e.effect = dragdropeffects.copy     end if end sub 

please try

private sub frmjig_dragenter(sender object, e drageventargs) _ handles me.dragenter      'change cursor  type drag , drop type     if e.data.getdatapresent(dataformats.filedrop) or e.data.getdatapresent("filegroupdescriptor")         e.effect = dragdropeffects.copy     end if end sub 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -