Hi All,
does anyone knows how to set the filter of the OpenFileDialog to a single
file?
I.E: I have a file "myfile.exe" , I want to force the OpenFileDialog to
search and display and see only that file when browsing ...no other exe.
Thank you
Zagor
Jens Hoffmann - 18 Mar 2006 23:04 GMT
public string activeFile = "myfile.exe";
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
//this.openFileDialog1.Filter = "exe files (*.exe)|myfile.exe|All files (*.*)|*.*";
//string filter = "exe files (*.exe)|" + activeFile;
string filter = " |" + activeFile;
this.openFileDialog1.Filter = filter;
this.openFileDialog1.FileName = activeFile;
this.openFileDialog1.ShowDialog();
}
//The commented lines are variants. Add file searching code
//when initializing the activeFile variable.
Greets
Jens
> Hi All,
>
[quoted text clipped - 7 lines]
>
> Zagor