c#中如何使用OpenDialog控件和SaveDialog控件,打开文件和保存文件,要求要有源程序(winform) 5
展开全部
private void menuItem3_Click(object sender, System.EventArgs e)
{
if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
System.IO.StreamReader sr = new System.IO.StreamReader(openFileDialog1.FileName);
this.ActiveMdiChild.ActiveControl.Text=sr.ReadToEnd();
sr.Close();
}
}
private void menuItem4_Click(object sender, System.EventArgs e)
{
if((saveFileDialog1.ShowDialog() == DialogResult.OK))
{
System.IO.FileStream fs = (System.IO.FileStream)saveFileDialog1.OpenFile();
}
}
{
if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
System.IO.StreamReader sr = new System.IO.StreamReader(openFileDialog1.FileName);
this.ActiveMdiChild.ActiveControl.Text=sr.ReadToEnd();
sr.Close();
}
}
private void menuItem4_Click(object sender, System.EventArgs e)
{
if((saveFileDialog1.ShowDialog() == DialogResult.OK))
{
System.IO.FileStream fs = (System.IO.FileStream)saveFileDialog1.OpenFile();
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询