Consider a MessageBox to prompt the user to answer yes or no. It works in our XP machines and one Windows 7 build machine.
However, it doesn't work on our Windows 7 Embedded machine. There is no error message, no MessageBox shows up. It just assumes the user clicked the Yes button because I can find the debug file created from there and createDatabase();
is called without any messageBox ahead of it.
I can find the assembly (System.Windows.Forms.dll) which is required by the MessageBox. It is in the same location as our Windows 7 build machine. do you have any idea why? thanks
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();
}
From this post, you could disable the "Message Box Default Reply" component from Windows 7 Embedded. Further details can be found on msdn.
The keyword here is "embedded". Such versions of Windows are often configured to run head-less (no monitor) or optimized to work without anybody being close. A MessageBox is poison to such a configuration. The machine stops running and nobody can find out why.
You need to go back to your system builder and find the option that controls this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With