Im using C# 2.0 and i have created an explorer tree that i can drag information from into a windows form. right now, when i drag from the treeview that im using, it performs DoDragDrop(selectedpath, DragDropEffects.Copy);
When i catch the event in my mainform, it is listed as a string. I am able to make this work but i want it to perform the same way that it does if i were to drag a file from my windows explorer window which is as follows
Array name = (Array)e.Data.GetData(DataFormats.FileDrop);
// Ensure that the list item index is contained in the data.
if (e.Data.GetDataPresent(typeof(System.String)))
{
Object item = (object)e.Data.GetData(typeof(System.String));
// Perform drag-and-drop, depending upon the effect.
if (e.Effect == DragDropEffects.Copy ||
e.Effect == DragDropEffects.Move)
{
//// Insert the item.
//if (indexOfItemUnderMouseToDrop != ListBox.NoMatches)
// ListDragTarget.Items.Insert(indexOfItemUnderMouseToDrop, item);
//else
// ListDragTarget.Items.Add(item);
}
}
i have tried to do DoDragDrop(new DataObject(selectedfile),DragDropEffects.Copy) but that doesnt work.