Easy VB6 question

I'm not sure if my computer is going crazy or me, but perhaps you can help us out.

pic="\\myMachine\pictures\zoo\311.jpg

print InStrRev(pic,"\",1)
 1

I don't see how it's coming up with "1".  I've done this many times in the past and don't know why I'm having trouble now.
hrolsonsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ZamZ0Commented:
In your code do you have a quote to close the file path?
0
Martin LissOlder than dirtCommented:
You need to use LoadPicture


Set pic.Picture=loadpicture("\\myMachine\pictures\zoo\311.jpg")

but I don't understand why you are trying then to reverse a string.
0
GrahamSkanRetiredCommented:
That seems OK. You start at position 1 and work backwards.

Try  InStrRev(pic,"\", -1)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

ZamZ0Commented:
Or InStrRev is starting at the beginning of the string and InStr starts at the end. So, when it looks for "\" it is the first character in the string. Maybe you could try InStr instead of InStrRev.
0
hrolsonsAuthor Commented:
Yes, it does have an ending double quote.

I'm not loading a picture, just working with the file name.

I want to isolate the file name so that txtGoodPart="311.jpg"
0
hrolsonsAuthor Commented:
ZamZ0, I need to find the last occurrence of it.
0
ZamZ0Commented:
Did you try InStr? That should work.
0
GrahamSkanRetiredCommented:
-1 for the third argument means 'start at the end'
0
hrolsonsAuthor Commented:
I've never tried the -1, that totally worked.  I looked at some old code and I was doing:

print InStrRev(pic, "\", len(pic))

Now it totally makes sense that it didn't find anything starting at position 1 and going backwards.
0
eemitCommented:
Try:
InStrRev(pic, "\")
0
Martin LissOlder than dirtCommented:
Your variable name 'pic' fooled me. In any case what result do you want to get? If it's 25 which is the position of the last '\' just leave off the 1.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.