简体   繁体   English

如何使用 FolderBrowserDialog 或类似的东西提示用户输入文件夹?

[英]How can I prompt the user for a folder using a FolderBrowserDialog or something like it?

I want to prompt the user for a folder, but allow them the possibility of pasting in a path.我想提示用户输入文件夹,但允许他们粘贴到路径中。 The FolderBrowswerDialog doesn't seem to support this. FolderBrowswerDialog 似乎不支持这一点。 I thought about using an OpenFileDialog, but that requires the user to select a file, which I don't want - though it does allow a user to type or paste in a path.我考虑过使用 OpenFileDialog,但这需要用户 select 一个我不想要的文件——尽管它确实允许用户在路径中键入或粘贴。

How can I have the user select a folder, but also allow them to type or paste in a path (to the folder)?我怎样才能让用户 select 有一个文件夹,还允许他们输入或粘贴路径(到文件夹)?

What you can do is making a form with a textbox and folderbrowsedialog.您可以做的是制作一个带有文本框和文件夹浏览对话框的表单。 Then the user can either paste or type in the folder address (Then you have to validate it) or just use the folderbrowsedialog in it.然后用户可以粘贴或键入文件夹地址(然后您必须验证它)或只使用其中的文件夹浏览对话框。

Then just show this form as a dialog whenever user wants to use it.然后只要用户想要使用它就将此表单显示为对话框。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM