Question Open File Dialog question?

raysefo

Well-known member
Joined
Jul 21, 2010
Messages
207
Programming Experience
Beginner
Hi,

I am using open file dialog on my windows form. In the directory, there are all txt files but what I would like to do is to filter those txt files that does not contain XML in the filename. Is there a way to do it?

Thanks in advance.

Best Regards
 
OpenFileDialog Class (System.Windows.Forms) Going through its member list, I'd say that class does not provide such functionality. You would have to provide your own browsing facility, for example a ListBox where you list the files matching your filter from a selected folder. FolderBrowserDialog is one of the options for that.
 
There also exist controls like DriveListBox, DirListBox and FileListBox, where for the latter you should take a closer look at the Pattern property. These controls are hidden by default, but you can use the 'choose items' Toolbox dialog to show them.
Note that these belong to Microsoft.VisualBasic.Compatibility.VB6 Namespace, so strictly speaking they are only for help in upgrading old VB6 projects. This means similar functionality exist in .Net library, or achieving the same is very simple using standard controls.
 
Back
Top