开发者

OpenFileDialog C#, allow user to type file name?

开发者 https://www.devze.com 2023-02-12 15:45 出处:网络
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 fil

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!

0

精彩评论

暂无评论...
验证码 换一张
取 消