Hi all,
I want to dag a file from explorer window and drop it on a pictureboc and copy the filename to an edit field, but the event never fired.
My code
pictureBox.AllowDrop = true;
pictureBox.DragEnter += new DragEventHandler(pictureBox_DragEnter);
pictureBox.DragDrop += new DragEventHandler(pictureBox_DragDrop);
// And the events
private void pictureBox_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy;
}
private void pictureBox_DragDrop(object sender, DragEventArgs e)
{
tbExcelsheet.Text = ((string[])e.Data.GetData(DataFormats.FileDrop, false))[0];
}
What is wrong
Regards Rinaldo
Full of ideas but don´t know how.