标签:简单 搜索 点击 hand 一个 handles create 文件对话框 send
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "Text (*.txt)|*.txt|All Files (*.*)|*.*";
sfd.FileName = "板材清单" + DateTime.Now.ToShortDateString().Replace(‘/‘, ‘-‘);
sfd.FileOk += Sfd_FileOk;//注册保存按钮的点击事件
sfd.ShowDialog();
string filePath = (sender as SaveFileDialog).FileName;
if (File.Exists(filePath))
{
File.Delete(filePath);
}
using (File.Create(filePath))
{
}
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Write))
using (StreamWriter sr = new StreamWriter(fs))
{
string plateList = HandleStockLoadingData.getInstance().GetAlreadyChoosePlateList();
string[] str = plateList.Split(‘;‘);
for (int i = 0; i < str.Length; i++)
{
sr.WriteLine(str[i]);
}
}
打开文件对话框 保存一个txt文件 比较简单用的时候省的搜索了
标签:简单 搜索 点击 hand 一个 handles create 文件对话框 send
原文地址:https://www.cnblogs.com/wosshiakuan/p/9838169.html