[RESOLVED] Drag & Drop Get File Properties
I have finally got the drag and drop to work on my form, so the user can drop files on it. I have used the msdn example so i can get the whole filename (path + filename). But how do i get only the filename? (lol.zip) And maybe the path where it is?
This is my current code:
Code:
string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false);
int i;
for (i = 0; i < s.Length; i++)
so if i write MessageBox.Show(s[i]) it shows the path + filename.
Re: Drag & Drop Get File Properties
why are you posting c# questions in the vb.net forum?
do you want the answer in vb?
Re: Drag & Drop Get File Properties
Code:
Dim theFileName As String = IO.Path.GetFileName("your-file-path-here")
Dim theFolderName As String = IO.Path.GetDirectoryName("your-file-path-here")
Re: Drag & Drop Get File Properties
try this:
vb Code:
Dim s() As Object = e.Data.GetData(DataFormats.FileDrop, False)
Dim fi As New IO.FileInfo(s(0))
MsgBox("Path = " & IO.Path.GetDirectoryName(fi.FullName) & Environment.NewLine & "Filename = " & IO.Path.GetFileName(fi.FullName))
Re: Drag & Drop Get File Properties
Sorry i posted wrong, but i guess i can translate that code to C.
Re: Drag & Drop Get File Properties
now i converted it and it works, thx :D