我尝试,当我按下保存时,SaveFileDialog
我会做一些事情。我尝试修复,但总是有问题。
SaveFileDialog dlg2 = new SaveFileDialog();
dlg2.Filter = "xml | *.xml";
dlg2.DefaultExt = "xml";
dlg2.ShowDialog();
if (dlg2.ShowDialog() == DialogResult.OK)
{....}
但我在 OK 上有错误 - 它说:
错误: “System.Nullable”不包含“OK”的定义,并且找不到接受“System.Nullable”类型的第一个参数的扩展方法“OK”(您是否缺少 using 指令或程序集引用?)
我尝试使用以下代码修复:
DialogResult result = dlg2.ShowDialog(); //here is error again
if (result == DialogResult.OK)
{....}
现在错误出现在 DialogResult 上说: “System.Windows.Window.DialogResult”是一个“属性”,但用作“类型”