By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,703 Members | 1,116 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,703 IT Pros & Developers. It's quick & easy.

finding absolute path on target machine

P: n/a
Hi,

Would someone please mind showing me how to obtain the absolute
path to a folder that is created under the application folder at install
time.

ie. On my development machine the path is
C:\engineering\development\software\BMSLITE\bin\Da tabase

On the target machine it may be c:\program files\orbit\bmslite\database

I tried the system.forms.application.startup path but this seemed to
continue to point to the development path on the target machine.

Thanks in advance


--

Kind Regards

David Huisman
General Manager
-----------------------------------------------------------------------
ORBIT COMMUNICATIONS Pty Ltd - Wireless Solutions that Work
(Telemetry, Control, Monitoring, Security, HVAC ...)
A.C.N. 107 441 869
Website : http://www.orbitcoms.com
PO Box 4474 Lakehaven
NSW 2263, AUSTRALIA
Phone: 61-2-4393-3627
Fax : 61-2-4393-3685
Mobile: 61-413-715-986
Nov 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Apologies,
I was a bit lazy, after a bit of research I found the answer.

filepath = System.Environment.CurrentDirectory & "\database\bmssql.mdf"

Thanks
David wrote:
Hi,

Would someone please mind showing me how to obtain the absolute
path to a folder that is created under the application folder at install
time.

ie. On my development machine the path is
C:\engineering\development\software\BMSLITE\bin\Da tabase

On the target machine it may be c:\program files\orbit\bmslite\database

I tried the system.forms.application.startup path but this seemed to
continue to point to the development path on the target machine.

Thanks in advance


--

Kind Regards

David Huisman
General Manager
-----------------------------------------------------------------------
ORBIT COMMUNICATIONS Pty Ltd - Wireless Solutions that Work
(Telemetry, Control, Monitoring, Security, HVAC ...)
A.C.N. 107 441 869
Website : http://www.orbitcoms.com
PO Box 4474 Lakehaven
NSW 2263, AUSTRALIA
Phone: 61-2-4393-3627
Fax : 61-2-4393-3685
Mobile: 61-413-715-986
Nov 23 '05 #2

P: n/a
"David" <we******@orbitcoms.com> schrieb:
I was a bit lazy, after a bit of research I found the answer.

filepath = System.Environment.CurrentDirectory & "\database\bmssql.mdf"


That's not a good idea, because the current directory can change while the
application is running. Instead, I suggest to use the routine which can be
found here:

<URL:http://dotnet.mvps.org/dotnet/code/application/#ApplicationPath>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.