Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hey, I just wonder how to prevent users from navigating to another directory. Example navigating from: "C:\" to "C:\WINDOWS". I want to stop all directory navigation for the user. I saw an article about this problem on this link: SaveFileDialog - InitialDirectory - prevent user from navigating to another directory[^], but I did not understand what the solution was. I heard you can use the SaveFileDialog's InitalDirectory. If someone could help me, please tell me if possible or not. Would be nice if you could show me the source code. Appreciated if you could clarify about this if not possible. :)

Note: This is for educational purposes only.

Thanks


- Rhaegal
Posted
Updated 9-Oct-15 3:19am
v14
Comments
CHill60 9-Oct-15 9:50am    
We're not going to write a custom control for you.
Why not just prompt for the folder name instead of using the dialog
Member 12043303 9-Oct-15 9:53am    
What do you mean by that? Any examples?

1 solution

If you want user to save file in a fixed location, then simply display a form that allows to type a file name.

Thus you do code your own form and do whatever you want to do. This could be a lot of work if you want most of the functionnality of common dialogs.

In that case, your application would look obsolete next time Microsoft update the UI. Also user might not like it to behave somehow differently than the standard one.

The user can still move and rename manually files on the system. Thus in the end, it might be a lot of effort for marginal benefits.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 9-Oct-15 14:51pm    
5ed.
I would add: there is no predefined concept of such "navigation"; it could be, say, setting a working directory. In nearly all such cases, limiting the path would be just the abuse. It's the application should work correctly no matter where the user "navigates".
—SA

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