Drag Drop getting file type or ID

  • Thread starter Thread starter Ames111
  • Start date Start date
A

Ames111

Hi i want to be able to determine what type of file is being dragged on
to my form, ive got this:

private void Form1_DragDrop(object sender, DragEventArgs e)
{
//tell me the file type please

}
private void Form1_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.All;

}

not much i know but its a start

i thought id get it through e.data.getdata but i cant figure it out.

i assumes different file types have some sort of different ID, i want
to check the ID of a certain file type, and capture those types of
files being dragged on to my form.

what are the different types? i understand theres a few issues around
the mail type from outlook?
 
Hello

Look at DataFormats, eg DataFormats.FileDrop etc
eg

if(e.Data.GetDataPresent(DataFormats.xxx) is what I want
then
do stuff..
 
Ames111,

There are no file type IDs or whatsoever. When you drag files you drag
strings that contain files' full names. You need to recognize your files by
their extensions (which can't be 100% error proof) or open the file and read
some signature in the beginning.
 
Back
Top