从文本框中打开资源管理器 [英] Open explorer from text box

查看:82
本文介绍了从文本框中打开资源管理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在Silverlight应用程序中有一个文本框和超链接按钮,如果在文本框中键入"C:/D:/filepath"并单击超链接按钮,则该页面显示后,它将根据我们在 new中给定的路径打开资源管理器 ..在这里,我必须打开我的C盘.所以建议我.
我写的像下面的格式,但不会得到..

Hi,
I have one textbox and hyperlink button in silverlight application, after the page is displayed if i type "C:/D:/filepath" in text box and click the hyperlink button it should open the according to our given path in new Explorer.. Here i have to open my C Drive. So pls suggest me..
I wrote like below format but it won''t getting..

string str1 = Uri.UnescapeDataString(str);
if (Uri.IsWellFormedUriString(str1, UriKind.Absolute))
{
       Uri uri = new Uri(str);
       linkBtn.NavigateUri = uri;
       linkBtn.TargetName = "_blank";
}
here: str: string from text box
      linkBtn: hyperlink button 


谢谢..


Thanks..

推荐答案



您需要启动资源管理器作为一个过程.

Hi,

You need to launch explorer as a process.

using System.Diagnostics;

TextBox pathTextBox = new TextBox();

Process p = new Process();            
p.StartInfo.FileName = "explorer";            
p.StartInfo.Arguments = @pathTextBox.Text; // make sure to include ''@''
p.Start();



戴夫



Dave


这篇关于从文本框中打开资源管理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆