Following Code snippet will return the folder path of the current running application.
Usage:
string strpath = GetExePath();
MessageBox.Show(strpath);
Screenshot:
public static string GetExePath() { string strPath = Application.ExecutablePath; string strBackSlash = @"\"; int nPos = -1; if ((nPos = strPath.LastIndexOf(strBackSlash)) > -1) { strPath = strPath.Substring(0, nPos + strBackSlash.Length); } return strPath; }
string strpath = GetExePath();
MessageBox.Show(strpath);
Screenshot:
No comments:
Post a Comment