【发布时间】:2011-09-14 16:19:26
【问题描述】:
我正在尝试使用此代码关闭消息框特定答案的表单。我不断收到一条错误消息,指出 Yes 和 No 都不属于 DialogResult::。我基本上直接从 MS 站点复制了这段代码,所以我不知道出了什么问题。帮忙?
private: System::Void Form1_FormClosing(System::Object^ sender, System::Windows::Forms::FormClosingEventArgs^ e) {
if(!watchdog->Checked)
{
if((MessageBox::Show("CAN Watchdog is currently OFF. If you exit with these settings, the SENSOWheel will still be engaged. To prevent this, please enable CAN Watchdog before closing. Would you still like to quit?", "Watchdog Warning", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == DialogResult::No))
{
return;
}
else
{
close_Click(this, e);
}
}
}
【问题讨论】:
-
这是一个 C++ 问题,它没有为类型标识符保留单独的符号表。您必须完整输入名称以避免与 Form::DialogResult 产生歧义。
标签: visual-studio-2010 visual-c++ messagebox formclosing dialogresult