LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove the 'all files' option on the file dialog

Hi I was wondering if anyone has a good way to tackle this problem.

 

In my application the user has the ability to load the contents of a tdms file into an xy graph. I am accomplishing this with a simple file control. I'd like to make sure that they can't load a file that is not a .tdms. I have used the pattern *.tdms on the properties for the control and the default view of the browse popup shows only .tdms files as I would expect but there is still an option for the user to change the file type to 'all files'

 

What I'd like to do is either remove the ability for the user to choose the 'all files' type. Failing that, I'll probably have to have my VI look at the file extension before loading the file to ensure that it is the right kind to avoid errors.

 

Are there any other options that I should look at for accomplishing this task?

0 Kudos
Message 1 of 3
(2,688 Views)

scrook wrote:

...but there is still an option for the user to change the file type to 'all files'

 

What I'd like to do is either remove the ability for the user to choose the 'all files' type. ...


"Nothing is fool-proof for a cleaver fool." (author unknown)

 

I'll watch for others to post other ideas but I think your proposed work-around is called for. I know of n way to shutdown the all files option.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 3
(2,676 Views)

You must also take care of the fools that "convert" any other file (*.txt, *.xls, *.pdf, etc.)  to tdms by simply changing the extension in explorer. 😮

 

(There are a few people here that "convert" *.bmp to *.jpg this way because attachments of bitmaps are not allowed. Just because the browser is smart enough to still display it despite the incorrect extension does not make it a jpeg image:). Others write to an ASCII formatted txt file but give it an *.xls extension. While this does not make it an excel file, it forces the file to be opened by excel, which does its best to make sense of it. Works most of the time :D).

 

Clearly, you need to check for proper extension after selection, but you should also handle the errors properly if the file is name *.tdms, but actually is something else.

Message 3 of 3
(2,663 Views)