> I have a text box in which I need the path of the file a user selects
> from the dialog box. I also want that the dialog box is filtered to
> show only image files, and when the user selects this file, the path
> of the file is shown on the text box.
It's not clear whether you're talking about a web application or a
WinForms application, but have you looked at the OpenFileDialog class?
Jon
RP - 11 Oct 2007 11:40 GMT
Windows Forms application.
Jon Skeet [C# MVP] - 11 Oct 2007 13:02 GMT
> Windows Forms application.
And have you looked at OpenFileDialog?
Jon
harborsparrow - 12 Oct 2007 03:49 GMT
Try something like this:
OpenFileDialog openFileDialog1 = null;
string newfilespec;
try
{
openFileDialog1 = new OpenFileDialog();
openFileDialog1.Title = "Select a text file to add to
the search list";
openFileDialog1.InitialDirectory = "C:\\";
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All
files (*.*)|*.*";
openFileDialog1.FilterIndex = 2;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
}
> > Windows Forms application.
>
> And have you looked at OpenFileDialog?
>
> Jon