Results 1 to 33 of 33

Thread: VB.NET - Correct method for app.path

Threaded View

  1. #1

    Thread Starter
    Let me in .. techyspecy's Avatar
    Join Date
    Aug 2002
    Location
    Back to VBF.
    Posts
    2,456

    VB.NET - Correct method for app.path

    Geez, Its been a pain in the freakin ass to get application path in .NET. Here you go buddy's

    VB Code:
    1. Private Function GetAppPath() As String
    2.         Dim l_intCharPos As Integer = 0, l_intReturnPos As Integer
    3.         Dim l_strAppPath As String
    4.  
    5.         l_strAppPath = System.Reflection.Assembly.GetExecutingAssembly.Location()
    6.  
    7.         While (1)
    8.             l_intCharPos = InStr(l_intCharPos + 1, l_strAppPath, "\", CompareMethod.Text)
    9.             If l_intCharPos = 0 Then
    10.                 If Right(Mid(l_strAppPath, 1, l_intReturnPos), 1) <> "\" Then
    11.                     Return Mid(l_strAppPath, 1, l_intReturnPos) & "\"
    12.                 Else
    13.                     Return Mid(l_strAppPath, 1, l_intReturnPos)
    14.                 End If
    15.                 Exit Function
    16.             End If
    17.             l_intReturnPos = l_intCharPos
    18.         End While
    19.     End Function
    Last edited by techyspecy; May 12th, 2003 at 05:47 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width