Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hallo,

I have an application that works with data saved in XML files.
Also, my configuration file is a XML file.

Is there any way to hide/exclude my XML file from the OpenFileDialog and SaveFileDialog lists?

I can set the attributes of my configuration file to hidden, but it continues appearing when the hidden files are also shown.
I can also make a checking after the file is selected and open a message informing of the prohibition of using that file.
Currently I am using he above 2 ideas, but they look not very professional.

Any idea will be welcome.

Thank you very much in advance.

David

Note: The idea of changing the extension name can not be used because the configuration file is used also by other applications that I can not change (neither the configuration file extension)
Posted
Updated 11-Apr-13 1:27am
v2
Comments
CHill60 11-Apr-13 8:27am    
As per OriginalGriff's last comment have a look at this CodeProject artcile Customizing OpenFileDialog in .NET[^]

1 solution

You can't explicitly say "don't show these files" or even "don't show these file types" with a standard common dialog, although you might be able to by hooking the dialog: http://www.vbaccelerator.com/home/VB/Code/Libraries/Common_Dialogs/Hooked_Common_Dialogs/article.asp.[^] - but don't ask me for help if it gets confusing, I've not played with that! :laugh:

Better solutions would be to either move your "unwanted" files to a different folder so they aren't easily found: Where should I store my data?[^] should give you some ideas on good locations.

The other solution is to restrict the list of file names so that it doesn't include XML files by specifying exactly which types you will accept via the Filter property.

That or write your own dialogs! :laugh:
 
Share this answer
 
Comments
NeueStudium2012 17-Apr-13 1:39am    
Hallo CHill60,
Thank you for your suggestions.
At the end, the only really effective way for me is checking if the file name is my setup file.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900