Make fileType for specific file name

I know how to make a fileType for a particular extension but can you make one for a file name.
For example I want to open a dialog so the user can find the specific file called “data.txt”. I don’t want them to be able to select any other .txt file.
You could do this in vb6.

[quote=193152:@Craig Grech]I know how to make a fileType for a particular extension but can you make one for a file name.
For example I want to open a dialog so the user can find the specific file called “data.txt”. I don’t want them to be able to select any other .txt file.
You could do this in vb6.[/quote]

Let us say you want just the files that start by “Foo” with extension txt :

Create a new FileTypes. Since you mention txt, a Text/Plain. In the second column, change Text in FooText. In the 5th column “Extensions” enter :

Foo*.txt

This code will open a file selector with only the text files with their name starting with Foo :

dim f as FolderItem = GetOpenFolderItem(FileTypes1.FooText)

The syntax is the same as what you would do in Dos.

*bar*.txt

Will find all text files containing bar in their name.

You can also use the “?” placeholder.

bar?.txt

This will display only the files with one letter after Bar. For instance Bar1.txt, Bar2.txt and so on.

Thanks, that works. One tiny glitch. It displays a * in front of the open file type name even when you don’t enter one in extensions.
ie. displays *data.txt instead of just data.txt