I had a form that allow user to input the Name and perform search on various defined folders and display searched files (full path) in listbox. Now I want to covert the "Full Path" string into hyperlink so when user click on it inside the ListBox, it will launch Window explorer to locate and highlight the file. Here is the code I got so far:
public void searchfile()
{
string fn = txt_filename.Text;
lst_box1.Items.Clear();
try
{
// Only get files that begin with the letter "c".
List<string> dirs = new List<string>();
dirs.AddRange(Directory.GetFiles(@"D:\Temp\Downloads", "*" + fn + "*"));
foreach (string dir in dirs)
{
lst_box1.Items.Add(dir);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
Thanks