-1

I have tried this but this only gets the file name not the extension. How do I get file name with extension?

string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, false);     
string filename = Path.GetFileNameWithoutExtension(FileList[0]);
Anup Sharma
  • 2,053
  • 20
  • 30
joy_n
  • 1
  • 2

1 Answers1

2

Path.GetFileName()

string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, false); 
string filename =  Path.GetFileName(FileList[0]);

Check the documentation

Overmachine
  • 1,723
  • 3
  • 15
  • 27