Nadeem
Nadeem

Reputation: 665

how to filter more than once in Microsoft.Win32.OpenFileDialog()

    Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
dlg.FileName = "Document"; // Default file name
dlg.DefaultExt = ".txt"; // Default file extension
dlg.Filter = "Text documents (.txt)|*.txt"; // Filter files by extension here

I want to filter more than one type

Upvotes: 1

Views: 1276

Answers (1)

Arvo
Arvo

Reputation: 10570

From http://msdn.microsoft.com/en-us/library/system.windows.forms.filedialog.filter.aspx:

For each filtering option, the filter string contains a description of the filter, followed by the vertical bar (|) and the filter pattern. The strings for different filtering options are separated by the vertical bar.

The following is an example of a filter string:

Text files (*.txt)|*.txt|All files (*.*)|*.*

Upvotes: 1

Related Questions