.NET 2.0 App.Path equivalent
I'm developing a Compact Framework 2.0 application. I want to use the old App.Path for setting some connection strings; however, App.Path is not used in 2.0. What is the equivalent? Thanks in advance.
# 3 Re: .NET 2.0 App.Path equivalent
A small gotcha to watch out for:
In VB6, you could use App.Path & "yourfilename"
In .NET, you have to add a \ before your filename:
Application.StartupPath & "\yourfilename"
# 4 Re: .NET 2.0 App.Path equivalent
VB6 provided the "\" for you only if your selecting the root. Otherwise, you had to specify it.
# 5 Re: .NET 2.0 App.Path equivalent
VB6 provided the "\" for you only if your selecting the root. Otherwise, you had to specify it.
Which is why I put "yourfilename" in the quotes,
not "yourpathname".
# 6 Re: .NET 2.0 App.Path equivalent
I suggest using the system.io.path.combine function for path and filename concatenation. It takes care of missing or present "\"
darren at 2007-11-11 21:53:12 >
