openFileDialog与saveFileDialog的使用

private void btnOpen_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string fileName = openFileDialog1.FileName;
txtInfo.Clear();
txtInfo.Text = File.ReadAllText(fileName);
}
} private void btnSave_Click(object sender, EventArgs e)
{
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
string fileName = saveFileDialog1.FileName;
File.WriteAllText(fileName, txtInfo.Text);
}
}
上一篇:《开源框架那些事儿22》:UI框架设计实战


下一篇:ASP.NET MVC 解析模板生成静态页一(RazorEngine)