excel表格vba编程的方法步骤(excel vba编程基础知识)
500
2022-05-30
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace SaveFileDialogTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
SaveFileDialog saveFile = new SaveFileDialog();
//saveFile.InitialDirectory = @"C:\";
saveFile.Filter = "文本文件|*.txt|97-2003Word文档|*.doc";
saveFile.FilterIndex = 1;
saveFile.FileName = "文本文件";
if (saveFile.ShowDialog() == DialogResult.OK)
{
string fName = saveFile.FileName;
FileStream fs = File.Open(fName, FileMode.Create);
StreamWriter sw = new StreamWriter(fs);
sw.Write(richTextBox1.Text);
sw.Close();
fs.Close();
}
}
}
}
C#
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。