OpenFileDialog C#, allow user to type file name?
I am using the OpenFileDialog
to let the user choose a file.
However, I also want the user to be able to type a file name in the box that shows the file开发者_Go百科 name selected and create that file if it does not exist....
Right now, if I type a file name and click the open button it says that file does not exist...
Is it possible to do that with OpenFileDialog
? thanks
Make sure you set OpenFileDialog.CheckFileExists = false
and .CheckPathExists = false
before showing the dialog.
create that file if it does not exist
It sounds like you need to use the SaveFileDialog
.
Setting OpenFileDialog.CheckFileExists = false
and OpenFileDialog.CheckPathExists = false
works for WPF also!
精彩评论