Better App.Path Function

Posted On 2007-05-03 by FortyPoundHead
Tags: VB6 Function Enhancement VB6 Files and I/O VB6 String Handling 
Views: 1875

App.Path returns a string with the "\" character at the end if the path is the root drive (e.g., "C:\") but without that character if it isn't (e.g., "C:\Program Files"). Most of the time we need the "\" at the end, so this function saves you the inconvenience of adding it every time.

Public Function AppPath() As String

    Dim sAns As String
    sAns = App.Path
    If Right(App.Path, 1) <> "\" Then sAns = sAns & "\"
    AppPath = sAns

End Function

About the Author

FortyPoundHead has posted a total of 1974 articles.

Comments On This Post

No comments on this post yet!

Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.

Your IP address is:

Before you can post, you need to prove you are human. If you log in, this test goes away.

Code Links