Get the application path

C

cntrl-S

Is there any equivalent of App.Path (VB 6.0) in VB.NET and
C#.
I would like to get the path of my exe at run time. I
tried Forms.Application.ExecutablePath which returns the
full path with application exe name included.
 
H

Herfried K. Wagner [MVP]

Hello,

cntrl-S said:
Is there any equivalent of App.Path (VB 6.0) in VB.NET and
C#.
I would like to get the path of my exe at run time. I
tried Forms.Application.ExecutablePath which returns the
full path with application exe name included.

\\\
Imports System.IO
Imports System.Reflection
..
..
..
Private Function ApplicationPath() As String
Return _
Path.GetDirectoryName( _
[Assembly].GetExecutingAssembly().Location _
)
End Function
///

HTH,
Herfried K. Wagner
 
P

Patrick Wimberly

Application.ExecutablePath will return the path that the
program is executing from. It seems to work like the
App.Path from VB6.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top