考虑一个 MessageBox 来提示用户回答是或否。它适用于我们的 XP 机器和一台 Windows 7 构建机器。
但是,它不适用于我们的 Windows 7 Embedded 机器。没有错误消息,没有 MessageBox 出现。它只是假设用户单击了 Yes 按钮,因为我可以找到从那里创建的调试文件,并且createDatabase();
在没有任何 messageBox 的情况下调用它。
我可以找到 MessageBox 所需的程序集 (System.Windows.Forms.dll)。它与我们的 Windows 7 构建机器位于同一位置。你知道为什么吗?谢谢
DialogResult result = System.Windows.Forms.MessageBox.Show(
"Do you want to update your database?\nWarning: All your data will be erased if you click Yes !",
"Update Database",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
string[] cmdLines2 = { @"C:\AndeDB\AndeDB.db is here and selected yes" };
//it will create, open and write or overwrite
File.WriteAllLines(@"C:\Temp\dbcheck2.txt", cmdLines2);
createDatabase();
}