Shaitan00 Posted June 10, 2009 Posted June 10, 2009 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, Quote
Administrators PlausiblyDamp Posted June 10, 2009 Administrators Posted June 10, 2009 Could you not just use the folder browse dialog instead? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Shaitan00 Posted June 10, 2009 Author Posted June 10, 2009 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? Quote
Leaders snarfblam Posted June 10, 2009 Leaders Posted June 10, 2009 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. Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.