I would like to know how to Drag and Drop a folder and get its name. I already know how to do it with a file, but I'm not really sure how to modify it to be able to drag folders as well. Here's the code of the event that is triggered when a file is dropped:
private void checkedListBox_DragDrop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
// NB: I'm only interested in the first file, even if there were
// multiple files dropped
string fileName = ((string[])e.Data.GetData(DataFormats.FileDrop))[0];
}
}