这里面那个 OpenFileDialog1.InitialDirectory出错,下面的也是,应该怎么改? 10
privatevoid打开文件ToolStripMenuItem_Click(objectsender,EventArgse){OpenFileDialog1.Initi...
private void 打开文件ToolStripMenuItem_Click(object sender,EventArgs e)
{
OpenFileDialog1.InitialDirectory = "C:\\";
OpenFileDialog1.Filter = "text文件(*.text)|*.text|rtf文件(*rtf)|*rtf|All files(*.*)|*.*";
OpenFileDialog1.FilterIndex = 2;
if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
{
Child1 = (Form2)this.ActivateMdiChild;//获取当前活动的窗口
if (Child1 ==null )
{
新建文件NToolStripMenuItem_Click(null, null);
Child1 = (Form2)this.ActivateMdiChild;
}
Child1.getRichTextBox().LoadFile(OpenFileDialog1.FileName);
Child1.Text = OpenFileDialog1.FileName;
}
}
每个OpenFileDialog1出错,如果没有1也是出错 展开
{
OpenFileDialog1.InitialDirectory = "C:\\";
OpenFileDialog1.Filter = "text文件(*.text)|*.text|rtf文件(*rtf)|*rtf|All files(*.*)|*.*";
OpenFileDialog1.FilterIndex = 2;
if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
{
Child1 = (Form2)this.ActivateMdiChild;//获取当前活动的窗口
if (Child1 ==null )
{
新建文件NToolStripMenuItem_Click(null, null);
Child1 = (Form2)this.ActivateMdiChild;
}
Child1.getRichTextBox().LoadFile(OpenFileDialog1.FileName);
Child1.Text = OpenFileDialog1.FileName;
}
}
每个OpenFileDialog1出错,如果没有1也是出错 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询