I Use following code for single file drag and drop.
private void FormRegion2_DragEnter_1(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{ e.Effect = DragDropEffects.Copy; }
// or this tells us if it is an Outlook attachment drop
else if (e.Data.GetDataPresent("FileGroupDescriptor"))
{ e.Effect = DragDropEffects.Copy; }
// or none of the above
else
{ e.Effect = DragDropEffects.None; }
}
private void FormRegion2_DragDrop_1(object sender, DragEventArgs e)
{
string[] fileNames = null;
if (e.Data.GetDataPresent(DataFormats.FileDrop, false) == true)
{
fileNames = (string[])e.Data.GetData(DataFormats.FileDrop);
foreach (string fileName in fileNames)
{
}
}
else if (e.Data.GetDataPresent("FileGroupDescriptor"))
{
object s = e.Data.GetData("FileGroupDescriptor");
Stream theStream = (Stream)e.Data.GetData("FileGroupDescriptor");
byte[] fileGroupDescriptor = new byte[512];
theStream.Read(fileGroupDescriptor, 0, 512);
StringBuilder fileName = new StringBuilder("");
for (int i = 76; fileGroupDescriptor[i] != 0; i++)
{ fileName.Append(Convert.ToChar(fileGroupDescriptor[i])); }
string theFile = fileName.ToString();
String fileName1 = System.IO.Path.GetFileName(theFile);
}
}
My problem is i am not able to get multiple file name. How it is possible to get multiple file name
Thx
I solve my problem Just add that code in any cs file.
And write drop function like that