Is there a way to prevent users from changing folders from the initial folder? I want all the (profile) files saved in the same folder?
Thanks in advance,
Hal
Printable View
Is there a way to prevent users from changing folders from the initial folder? I want all the (profile) files saved in the same folder?
Thanks in advance,
Hal
Hi!
Not 100% sure I know what you mean here, but I suspect that you are facing the problem with the SaveFileDialog changing the current directory after a successful operation. This can be prevented by setting the property RestoreDirectory to true:
Otherwise, please ******** what you mean!Code:saveFileDialog1.RestoreDirectory = true;
HTH!
Anders,
Thanks for the reply. I'll try to explain this better. I have set the initial folder to the application's profile folder (Application.StartupPath + "\\Profiles"). I want to prevent users from changing to another folder (and saving the profile somewhere other than Application.StartupPath + "\\Profiles"). Hope this is more clear.
Regards,
Hal
Well, I think you've made yourself clear, but I still don't understand :-)
I mean, Application.StartupPath + "\\Profiles" will always be Application.StartupPath + "\\Profiles", wont it? Why use a SaveFileDialog for this?
Why give the user the possibiliby to select a folder at all, if you want all the profiles to be saved in Application.StartupPath + "\\Profiles? If feedback is the issue I would popup a MessageBox saying "settings have been saved to C:\Program files\Your Company\Your Application\Profiles".
Sorry, I am afraid I don't get it, and I am afraid I'm wasting your time!
Ah! Maybe you want to give the user the chance to select a name of the settings file, but you want it to be saved in Application.StartupPath + "\\Profiles"? And you want the user to be able to select an existing settings file on subsequent saves, so you think that a SaveFileDialog would be suitable. I agree, that would be nice, but I am not sure you can prevent the user from changing folder in a SaveFileDialog. In this case, what I would do is to list all the files in Application.StartupPath + "\\Profiles" into a listbox or similar, add a textbox, and give the user the option to either specify a new filename, or select an item from the listbox, and then save to that file.
/ Anders