Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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..
Posted
Updated 16-Sep-10 19:07pm
v3

1 solution

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
 
Share this answer
 
Comments
AspDotNetDev 16-Sep-10 21:28pm    
The @ sign is not useful here at all. You are probably confusing it with its usage with literal strings. I'm pretty sure it's use here is so you can use a variable named after a C# keyword.
DavidKiryazi 17-Sep-10 1:16am    
yeah I think your right :) my mistake
Baji Jabbar 17-Sep-10 3:10am    
Nice one :thumbsup:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900