求大虾们解答,C#新建文本问题
if (richTextBox1.Text != ""){
DialogResult = MessageBox.Show("是否保存?", "信息提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
SaveFileDialog saveFile1 = new SaveFileDialog();
saveFile1.InitialDirectory = "C:\\";
saveFile1.Filter = "文本文档(*.txt)|*.txt|所有文件(*.*)|*.txt";
saveFile1.FilterIndex = 2;
saveFile1.RestoreDirectory = true;
if (saveFile1.ShowDialog() == DialogResult.OK)
{
richTextBox1.SaveFile(saveFile1.FileName, RichTextBoxStreamType.PlainText);
}
else
{
richTextBox1.Clear();
}
}
else
return;
调试后,点新建文本功能,弹跳出提示框,可不管点击确定还是取消,都会跳出保存功能,而我要实现的是只点击确定才跳出保存功能...希望大虾们能帮帮我