And here is the correct working code.
Public Declare Function GetModuleFileName Lib "Coredll" _
Alias "GetModuleFileNameW" _
(ByVal hModule As Int32, _
ByVal lpFileName As String, _
ByVal nSize As Int32) As Int32
Public Function App_Path() As String
Dim bufferV As New String(CChar(" "), 301)
Dim retVal As Long
Dim iRetVal As Integer
retVal = GetModuleFileName(0&, bufferV, 300)
bufferV = Strings.Left(bufferV, retVal)
iRetVal = Strings.InStrRev(bufferV, "\")
If iRetVal > 0 Then
bufferV = Strings.Left(bufferV, iRetVal)
Return bufferV
Else
Return Nothing
End If
End Function