如何取得工程当前工作目录? 如题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Environment.CurrentDiectory不过注意用openfileDialog时路径可能会被改变! Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName); Environment.CurrentDiectory Application.StartUpPath 可能有拼写错误 C/S Application.StartupPath能获取到! C/SAppDomain.CurrentDomain.SetupInformation.ApplicationBase System .AppDomain .CurrentDomain .BaseDirectory 再给你一个c/s b/s 都能用的 #region String GetCurrentFullPath() // 获取当前地址(通用,即可获得WinForm运行根目录也可获得Web IIS虚拟根目录 /// <summary> /// 获取当前地址 /// </summary> /// <returns>当前地址</returns> public String GetCurrentFullPath() { String CurrentCodeBase = Assembly.GetExecutingAssembly().CodeBase; CurrentCodeBase = CurrentCodeBase.Substring(8, CurrentCodeBase.Length - 8); String[] Sections = CurrentCodeBase.Split(new char[] { '/' }); String Result = String.Empty; for (int i = 0; i < Sections.Length - 1; i++) Result += Sections[i] + "\\"; return Result; } #endregion 还有这么多的方法啊,收下先。我就晓得Application.StartupPath和Environment.CurrentDirectory 字符串 winform中的隐藏功能 如何引用ExcelHandler的dll 多表联合查询,怎么提高查询性能。 请教查询后的填充问题 哪位高手帮帮忙阿 关闭SqlConnection对象出错 我有个控件,可以通过JAVASCRIPT添加和删除HTML 文本框,文本框ID号由程序动态产生,文本框个数由操作用户确定,我在C#怎么获取这些文本 wcf上传文件 Codedom 代码生成问题 excel数据导入access方法 在一个新的类中如何实现调用带输入参数存储过程 菜鸟求助(在线等,解决马上给分) c# appconfig的动态读写问题
不过注意用openfileDialog时路径可能会被改变!
Application.StartUpPath
可能有拼写错误
再给你一个c/s b/s 都能用的
#region String GetCurrentFullPath() // 获取当前地址(通用,即可获得WinForm运行根目录也可获得Web IIS虚拟根目录
/// <summary>
/// 获取当前地址
/// </summary>
/// <returns>当前地址</returns>
public String GetCurrentFullPath()
{
String CurrentCodeBase = Assembly.GetExecutingAssembly().CodeBase;
CurrentCodeBase = CurrentCodeBase.Substring(8, CurrentCodeBase.Length - 8);
String[] Sections = CurrentCodeBase.Split(new char[] { '/' });
String Result = String.Empty;
for (int i = 0; i < Sections.Length - 1; i++)
Result += Sections[i] + "\\";
return Result;
}
#endregion
我就晓得Application.StartupPath和Environment.CurrentDirectory