I use OpenFileDialog
in VB.NET for importing file from C:\ , but when I choose my file , can I show ONLY the file name (not a complete path ) ?
I want to see only namefile.pdf, and not c:....\namefile.pdf
Here is my code:
fichier.Filter = "PDF Files|*.pdf|image files|*.png;*.jpg;*.gif"
If fichier.ShowDialog = DialogResult.OK Then
fichier_txt.Text = fichier.FileName
End If
fichier is OpenFileDialog
name
答案 0 :(得分:1)
Use Path.GetFileName.
fichier.Filter = "PDF Files|*.pdf|image files|*.png;*.jpg;*.gif"
If fichier.ShowDialog = DialogResult.OK Then
fichier_txt.Text = Path.GetFileName(fichier.FileName)
End If