CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2001
    Location
    AZ
    Posts
    201

    SaveFileDialog question

    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
    up·grade (up'gräd'),
    to take out old bugs
    and put in new ones.

  2. #2
    Join Date
    Jul 1999
    Location
    Malmö, Sweden
    Posts
    126

    Re: SaveFileDialog question

    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:
    Code:
    saveFileDialog1.RestoreDirectory = true;
    Otherwise, please ******** what you mean!

    HTH!

  3. #3
    Join Date
    Feb 2001
    Location
    AZ
    Posts
    201

    Re: SaveFileDialog question

    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
    up·grade (up'gräd'),
    to take out old bugs
    and put in new ones.

  4. #4
    Join Date
    Jul 1999
    Location
    Malmö, Sweden
    Posts
    126

    Re: SaveFileDialog question

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured