双击1.txt文件如何用C#代码获取它的完整路径? RT,做了个类似于记事本的winform程序!将txt文件关联用我做的程序打开!结果打开的时候读取不到信息!如何双击1.txt打开的时候,把内容读到程序里呢!我的想法是先获取完整路径,在窗体加载事件里读取,但是获取不来!或者是有没有其他更好的方法! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 资料private void Form1_Load(object sender, EventArgs e) { #region//取得双击后的文件名,并读取 string PathFileName = Environment.CommandLine; string[] para=PathFileName.Split('\"'); if (para.Length > 3) { ReadText(para[3]); } #endregion } private void ReadText(string PathFileName) { StreamReader sr = new StreamReader(PathFileName, Encoding.Default); string readtxt = sr.ReadToEnd(); richTextBox.Text = readtxt; sr.Close(); } C# crystalreport取不到数据 如何将数据表的行与列调转? 智能棋类程序的类怎么构造? 关于怎样杀掉杀毒程序进程??????????????????? 请问c#如何将word转换成flash C#程序怎样调用windows IPA? c# 图像保存求助,图像很大主要这个导致保存困难,求大侠们思路,谢谢 求电子书:think in c# 和 C# 精髓 调用浏览器下载不行? winform 中使用线程后 导致无法关闭程序 请问一个图片存到oracle数据库里的问题 C# UDP通讯 数据量很大
{
#region//取得双击后的文件名,并读取
string PathFileName = Environment.CommandLine;
string[] para=PathFileName.Split('\"');
if (para.Length > 3)
{
ReadText(para[3]);
}
#endregion
} private void ReadText(string PathFileName)
{
StreamReader sr = new StreamReader(PathFileName, Encoding.Default);
string readtxt = sr.ReadToEnd();
richTextBox.Text = readtxt;
sr.Close();
}