How do I get the Name of an image returned to a text box

I have looked through the knowledge base and can't find anything on getting just the image name from a image then populating a text box with it.
String functions probably will not work because of the varying length of image names in the file path. Not sure if I can get it from a  "Name" function or not.
Example: subStr = ImageLocation
ImageLocation = ("C:/ users/jschmuck/locations/images/Axes/axe1.jpg")

All I want is the axe1.jpg, but the image name could have 3-25 characters.
Such as Unk_Ax_VP1.jpg 0r VP_Aux_Unk_3.jpg

All help is greatly apreciated.
Who is Participating?
Rey Obrero (Capricorn1)Connect With a Mentor Commented:

Engtech05Author Commented:
I copied the code and tried it all I got was the file path, is there a different way?
Rey Obrero (Capricorn1)Connect With a Mentor Commented:
what do you mean by, all I got was the file path?
check your the content of  imageLocation..

try the function with this

sub getImageName()

dim imageLocation as string, imageName
imagelocation="C:/ users/jschmuck/locations/images/Axes/axe1.jpg"


msgbox imageName

end sub

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Can you explain just a little more about what you are trying to do.
Are you trying to read a directory that has an image in it? or pull some information from the database and populate fields with it?

if you always know the location of the file you could always use an explode() or a preg_split() to get the part that you want isolated from the whole file location.

if i have more of an idea of what you are trying to do, I may be able to help better
$location = "C:/users/jschmuck/locations/images/Axes/axe1.jpg";
$fileName = explode("/", $location);
echo $fileName[7];

Open in new window

Engtech05Author Commented:
Ok, I found the issue with the code the slash was backwards should have been "\" instead of "/".
Thanks for the help guys, points forthwith.
Engtech05Author Commented:
Just a minute fix but is works. Thanks again.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.