The legal tricks-Learn Your Self

Latest gadgets,softwares,hardware,reviews,programming and campuses, game cheats ext......

A Better App.Path

Version Compatibility: Visual Basic 5, Visual Basic 6

More information: 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.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Public Function AppPath() As String

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

End Function

0 comments: