c# - 在 C# 应用程序中的选定位置创建 txt 文件

标签 c# winforms

<分区>

我正在开发一个 C# 应用程序。在此表单中,我添加了 2 个按钮。 这些是 BrowseCreate File 按钮。

现在我想做的是使用浏览按钮浏览一个位置,然后单击 Create file 按钮,在该位置创建一个文本文件。

最佳答案

看看

SaveFileDialog Class

Prompts the user to select a location for saving a file.

FolderBrowserDialog Class

Prompts the user to select a folder.

File.Create Method

Creates a file in the specified path.

甚至

File.CreateText Method

Creates or opens a file for writing UTF-8 encoded text

关于c# - 在 C# 应用程序中的选定位置创建 txt 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18266706/

相关文章:

c# - 将第 3 方 C++ DLL 引用到 VS 2013 项目中

c# - 将单个 Func<T,bool> 与 Where() 和继承一起使用

c# - 为什么运行时窗口更大?

c# - 在构造函数中进行冗长的操作是否被认为是糟糕的设计?

c# - 如何将通用列表作为构造函数传递?

c# - ComboBox 不会在 DataSource 更改时自动更新?

c# - Windows Media Player - 播放完毕后隐藏播放器

c# - 设计 SOA WCF Web 服务时的最佳实践是什么?

c# - 升级到 VS2017 后找不到任何适合该文化或中立文化错误的资源

c# - 为什么有时在计时器滴答事件中它会连续调用该方法两次?