How to get file name from openfiledialog without file path
-
How I can get the filename from the openfiledialog without the full path? I have filename as in openfiledialog "C:\Upload\trp.txt" I want Only "trp.txt". How this can be done by vb.net 2005? THanks in advance
There is a better way to do it, I am sure. And perhaps someone else will also answer your question with this better solution, but here is the one that I remember using once:
Dim backslash As Char = "\" TxtFileName.Text = "" OFD.ShowDialog() TxtFileName.Text = OFD.FileName.Substring(OFD.FileName.LastIndexOf(backslash) + 1)
My advice is free, and you may get what you paid for.
-
How I can get the filename from the openfiledialog without the full path? I have filename as in openfiledialog "C:\Upload\trp.txt" I want Only "trp.txt". How this can be done by vb.net 2005? THanks in advance