By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,237 Members | 1,162 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,237 IT Pros & Developers. It's quick & easy.

Get filename without the path - Beginner in VB

P: n/a
Hi

I have a filedialog that returns the entire path and the filename of a given
file.
How can I remove the filepath from the filename property and only have the
basic filename.
Say I have a file test.txt located in c:\users\username, then the
filedialog.filename property returns "c:\users\username\test.txt".
What I need is a way to remove "C:\users\username" and only have the
test.txt entry.

It is probably an easy task, but I can't see it.

/A.

Oct 9 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
try looking at the static class

System.IO.Path

hope that helps
--
-iwdu15
Oct 9 '07 #2

P: n/a
"Andy" <an**@spamblocker.orgwrote in message
news:eI**************@TK2MSFTNGP06.phx.gbl...
Hi

I have a filedialog that returns the entire path and the filename of a
given file.
How can I remove the filepath from the filename property and only have the
basic filename.
Say I have a file test.txt located in c:\users\username, then the
filedialog.filename property returns "c:\users\username\test.txt".
What I need is a way to remove "C:\users\username" and only have the
test.txt entry.

It is probably an easy task, but I can't see it.

/A.
System.IO.Path.GetFileName("c:\users\username\test .txt")
Oct 9 '07 #3

P: n/a
Thanks

Just what I was looking for.

/A
"iwdu15" <jmmgoalsteratyahoodotcomwrote in message
news:B3**********************************@microsof t.com...
try looking at the static class

System.IO.Path

hope that helps
--
-iwdu15
Oct 9 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.