Dropping a DataObject from Win form to desktop.

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2008
Posts: 169
Reputation: murderotica is an unknown quantity at this point 
Solved Threads: 2
murderotica's Avatar
murderotica murderotica is offline Offline
Junior Poster

Dropping a DataObject from Win form to desktop.

 
0
  #1
Jan 12th, 2009
Hello there, I have created and application where the items in a ListView will be dragged and dropped over the desktop. So far, I was able to implement the drag but cannot drop the item. The function I used should be detected by windows but it cannot register the drop on the desktop. Here is my code:

  1. private void listview_ItemDrag(object sender, ItemDragEventArgs e){
  2. DataObject object = new DataObject()
  3. string f = listview.SelectedItems[0].Text;
  4. object.SetData(DataFormats.FileDrop, f);
  5. DoDragDrop(object, DragDropEffects.All);
  6. }

I can't find any article that could enlighten me. I've been stuck in this code for days now. What seems to be the problem?
An Avalanche In D Minor
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: Dropping a DataObject from Win form to desktop.

 
0
  #2
Jan 13th, 2009
Im guessing because your object doesnt contain a file, it contains a filename, and you cant just put a string object to desktop.

I googled found plenty of examples, which work - i would suggest you do the same.
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 169
Reputation: murderotica is an unknown quantity at this point 
Solved Threads: 2
murderotica's Avatar
murderotica murderotica is offline Offline
Junior Poster

Re: Dropping a DataObject from Win form to desktop.

 
0
  #3
Jan 13th, 2009
You've been lucky with google my friend. I found 2 examples that adheres to my issue; one was dragging and dropping a url from a form to the desktop and the other was he gave the example that I'm using. Can you share to me the samples that you've found?
An Avalanche In D Minor
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: Dropping a DataObject from Win form to desktop.

 
0
  #4
Jan 13th, 2009
Well the first I found was a URL dropper, and he does a heck of a lot more than you've shown code for, including creating the file so it can be written to desktop.
While the file he writes is a shortcut, the principal is the same.
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC