View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Check for invalid file types?

Robert Crandal used his keyboard to write :
I am using the FileDialog() function to let users select multiple
files. After the user chooses all their files and presses the
"Okay" button, my program loops to each chosen file.

Is there an effective way to test when a user chooses an
invalid file type? My users are only allowed to choose
plain text files, hopefully files ending in *.txt. I'm just
looking for ideas how to prevent users from choosing
files that contain non-text data.

Thank you!

Robert


I use the Filters property of a FileDialog to limit what files can be
seen. For example, my cnc program files manager app only lets users see
files with the user-defined filetypes. The default is no extension as
cnc files normally have none (ie: "O1001" is a Fanuc style program
file), but some retrofit machines have their own filetypes. The
FileTypes list is what a Filter property uses for file browsing.

My Excel apps use their own filename extensions and so I filter on
these as defaults when browsing for app files.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion