class object current dir

  • Thread starter Thread starter Ron
  • Start date Start date
R

Ron

Does anyone know how to find out the current directory of a class.

My business object is using a Microsoft Access backend and I have to
hard code the path of my connectionstring.

Thanks.
 
This will give the path to the assembly from which the process is running (I
think that's what you're asking for):

Dim exePath As String =
System.Reflection.[Assembly].GetExecutingAssembly.CodeBase()


In my sample this equals (MyEXE is the name of the assembly):
file:///C:/Documents and Settings/Owner/My Documents/Visual Studio
Projects/MyEXE/bin/MyEXE.exe



You can parse the string to get the directory.

Hope that helps,

-- Prester John
 
Back
Top