Read a file in the app. folder

R

Ramon N. Gene

Hi:
I'm working in a PPC 2002 application with VS.net 2003
and C#.
I'm trying to read a file (config.xml), located in my
application installation folder.
Currently I'm using:
config.ReadXml("\\Program Files\\MyApp\\config.xml");
and it's working fine.

What I would like to do is avoid the "\\Program
Files\\MyApp\\" part, because if the application is
installed in a different location (like a storage card)
it won't work.

I tried
config.ReadXml("config.xml");
but then the application looks in "My Device" and of
course don't find the config file.

Thanks in advance,

Ramon
 
R

Ramon N. Gene

Hi Paul:
Thank you for both advices.
I tried the search with application directory and get
lot of results with either one or the other word. I think
if we could have a search for Exact Phrase in these
newsgroups it would be very helpful.
Also tried "application directory" and got: Please
remove any punctuation symbols from the search field.

Thanks,
Ramon
 
A

Alex Feinman [MVP]

using System.Reflection;
using System.IO;

strPath =
Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQ
ualifiedName);
 
G

Geoff Schwab [MSFT]

Hi Ramon,

The FAQ is also a good source of information:

7.1. How do I determine the application's root directory?
http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/FAQ/default.aspx#7.1

It includes a code sample and links to two short HOWTO articles.

--
Geoff Schwab
Program Manager
Excell Data Corporation
http://msdn.com/mobility
http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/FAQ/default.aspx

This posting is provided "AS IS" with no warranties, and confers no rights.
 
R

Ramon N. Gene

I know google allows that.
I was talking about improving the search in these
newsgroups, not google.
Anyway, I really appreciate you taking the time to help
me out with this issue.

Thanks,
Ramon
 
P

Paul G. Tobey [eMVP]

There is no 'search' in the newsgroup itself. The newsgroup protocol itself
doesn't provide for anything other than message transfer. I've never used
it, but if you mean the Microsoft Web-based interface, then you should
direct that comment to the Web people at Microsoft. Personally, I use
Outlook Express, but others use various other readers and they all work...

Paul T.
 
R

Ramon N. Gene

I was referring to the web-based interface. I touhgt you
were using the same thing when you said "Here's the first
item returned from an archive search".

Thanks,
Ramon N. Gene
 
V

Vinay Chaudhari

Hi Ramon,

My experience with MS web interface for their pulic newsgroups is bad.
Frankly, the interface is pathetic. Please use google for searching the
newsgroups. If you don't know or haven't noticed, google has "Groups"
tab where you can type in newsgroup name and then get an excellent
interface for browing/searching one or more newsgroups.

-Vinay.
 

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