Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

DragDrop file event not fired

$
0
0

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.


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>