| | |
Dropping a DataObject from Win form to desktop.
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
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:
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?
C# Syntax (Toggle Plain Text)
private void listview_ItemDrag(object sender, ItemDragEventArgs e){ DataObject object = new DataObject() string f = listview.SelectedItems[0].Text; object.SetData(DataFormats.FileDrop, f); DoDragDrop(object, DragDropEffects.All); }
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
•
•
Join Date: Aug 2008
Posts: 1,735
Reputation:
Solved Threads: 186
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.
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.
•
•
Join Date: Aug 2008
Posts: 1,735
Reputation:
Solved Threads: 186
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.
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.
![]() |
Other Threads in the C# Forum
- Previous Thread: saving arrays
- Next Thread: C# Coding for Access Database In Server
| Thread Tools | Search this Thread |
.net access algorithm array asp.net barchart bitmap box broadcast c# check checkbox client combobox control conversion csharp custom database databaseconnection datagrid datagridview dataset datetime dbconnection degrees design development draganddrop drawing encryption enum event eventhandlers excel file firefox form format forms function gdi+ grantorrevokepermissionthroughc#.net httpwebrequest image index input install java label libraries list listbox loop mandelbrot marshalbyrefobject math mouseclick movingimage mysql mysql.data.client operator path photoshop picturebox pixelinversion platform post programming radians regex remote remoting resourcefile richtextbox server sleep socket sql statistics stream string system.servicemodel table tcpclientchannel text textbox thread time timer update usercontrol validation visualstudio webbrowser windows winforms wpf wpfc# xml






