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
 

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

Back
Top