Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

In my application I am using a SaveFileDialog to prompt the user to save a generated file to a specific location - however I need to ensure that the file name itself cannot be changed...

 

For example, I have the following code:


saveFileDialog.Title = "Save File";
saveFileDialog.InitialDirectory = "C:\\";
saveFileDialog.Filter = "Zip File (*.zip)|*.zip";
saveFileDialog.FileName = "A.ZIP";
if (saveFileDialog.ShowDialog() != DialogResult.Cancel)
File.Copy(sFile, saveFileDialog.FileName, true);
[/Code]

 

Now, this works perfectly fine, the default under file name is "A.ZIP" but the user can change that and save it as anything they want, I need to ensure they cannot change the file name (A.ZIP) and only define where the file should be saved ...

 

Is there a way to set that field as read-only (for example?)

Any help, hints, or ideas would be much appreciated.

 

Thanks,

Posted

See thats my problem - using the FolderBrowserDialog the user has no clue what file he is saving ... they need to know the file name (so they can go collect it later) but not be able to change it ..

 

Any clues?

  • Leaders
Posted
See thats my problem - using the FolderBrowserDialog the user has no clue what file he is saving ... they need to know the file name (so they can go collect it later) but not be able to change it ..

 

Any clues?

 

Why not display the file's name via the description property of the FolderBrowserDialog? I.e.

folderBrowserDialog1.Description = "Select a folder to save A.zip";

Either that, or ignore the filename specified by the user.

[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...