Search Tools Links Login

Detect "" in directory


Visual Basic 6, or VB Classic

Suppose You try to get the app.path when the app is in the C Drive. the result is "C:". if the app is in another directory the result may be "C:Directory". notice there is no backslash. most people skip this because they don't think it is a problem, but it is. when you put in a program, app.path & "filename.file", when it is in the C Drive or if you put app.path & "filename.file" in a named directory, the computer will either return "C:\filename.file" or "C:Directoryfilename.file". this code will show you how to detect the backslash and deal with it.

Original Author: Eric LeBourgeois

Code

'this code will give you a valid filename, whether the app.path return has a backslash or not, and displays a message box.
'Please Vote for me at Planet Source Code
if right(app.path,1) = "" then 'sees if the directory has a backslash at the end of it
msgbox app.path & "filename.file"
goto ResumeMe
end if
msgbox app.path & "filename.file"
ResumeMe:

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 102 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.