appPath

  • Thread starter Thread starter gs
  • Start date Start date
G

gs

Dim appPathFn As String

appPathFn = System.Windows.Forms.Application.ExecutablePath

Windows is not a member of System

I saw come code in the internet as

appPathFn = Application.ExecutablePath
but that does not work for me


I am using visual basic .net express 2005. don't know if that make any
difference. So far Google has not helped me yet
 
Dim appPathFn As String

appPathFn = System.Windows.Forms.Application.ExecutablePath

Windows is not a member of System

I saw come code in the internet as

appPathFn = Application.ExecutablePath
but that does not work for me


I am using visual basic .net express 2005. don't know if that make any
difference. So far Google has not helped me yet

Application.ExecutablePath is a valid statement, but it's name is a
bit misleading. The statement actually returns the location of and
the name of the executable file as one concacted string.

If you are looking for the path only where the application's
executable is located, try:
My.Application.Info.DirectoryPath

Gene
 
gs said:
Dim appPathFn As String

appPathFn = System.Windows.Forms.Application.ExecutablePath

Windows is not a member of System

Make sure your project contains a reference to "System.Windows.Forms.dll".
 
thank you very much for telling me making a reference to
system.windows.forms.... I add reference to System.Windows.Form...., now I
got the Application.ExecutablePath recognized.

Prior to that "import System.Windows" does not work not using the fully
qualified name for Application.

I guess most people and articles assume this reference as basic and common
knowledge but I am just an occasional vb programmer supplementing some
legacy application with new functionality.
 
Back
Top