首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

路径设置有关问题

2013-03-04 
路径设置问题文件 --bin--debug--exe--A--a.txt--B--C--c.txt三个文件夹bin A B 在同一个目录下 用Applica

路径设置问题
文件 --bin--debug--exe
     --A--a.txt
     --B--C--c.txt
三个文件夹bin A B 在同一个目录下 

用Application.StartupPath取得应用程序exe文件启动的目录路径
比如 string strPath = Application.StartupPath;
我现在要想取得a.txt和c.txt的路径,该怎么取?

外行刚开始接触C#程序,请教
[解决办法]
哦,搞错了,A B Bin同一目录,还得往上返一层

string strPath = Application.StartupPath;
int i=strPath.LastIndexOf("\");
strPath=strPath.Substring(0,i);
i=strPath.LastIndexOf("\");

string strPathA=strPath.Substring(0,i) + "\\A\\a.txt";
string strPathC=strPath.Substring(0,i) + "\\B\\C\\c.txt";

热点排行