hi guys! how can I get the path of the folder that is dragged to my listbox?
Printable View
hi guys! how can I get the path of the folder that is dragged to my listbox?
In the DragDrop event handler the dragged data is returned to you through the e.Data property, which is type IDataObject. You are interested in the GetFormats and GetData methods of that IDataObject object. Call GetFormats and it will tell you what formats the data can be retrieved in. Once you know the available formats you can call GetData to get the data in those formats. Do that and see what you get with each format and then make a choice as to which is most useful to you and go with that.
Now remember that if your ListBox is a valid drop target then you need to use the DragEnter event to exclude any data that is not of a type that you want your ListBox to accept.