开发者

how to get the application physical path in windows forms application

开发者 https://www.devze.com 2023-03-01 05:34 出处:网络
how to get the ap开发者_Go百科plication path in windows forms , i used the bellow code but it is saying like \"method not found\"

how to get the ap开发者_Go百科plication path in windows forms , i used the bellow code but it is saying like "method not found"

Application.ExecutablePath;
Application.StartupPath;

please suggest me am i missing any namespace ?

thanks in advance


This will return the complete path to your Application

System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)


You can do it like this as well

          System.AppDomain.CurrentDomain.BaseDirectory


System.Windows.Forms.Application.StartupPath must return the path of the running executable.


Add reference System.Windows.Forms and add in using section

using System.Windows.Forms;


Generally, Application.StartupPath() will give the path of the application. And also r u missing this namespace. System.Windows.Forms

0

精彩评论

暂无评论...
验证码 换一张
取 消