我是c#的菜鸟,帮我看看这段代码问题出在哪里:
private void end_btn_Click(object sender, System.EventArgs e)
{

 MessageBox.Show("确定退出系统?","结束",MessageBoxButtons.OKCancel,MessageBoxIcon.Question,MessageBoxDefaultButton.Button2);

if (MessageBox.Show ( ) == MsgBoxResult.OK)
{
Close();
}
}
我想点击推出菜单时,弹出对话框,提示“取消”或“确定”,当我点“确定”时,大窗口关闭。问题应该出在(MessageBox.Show ( ) == MsgBoxResult.OK),但我不知道怎么改,或懂vc的大侠帮我用vc写一个也可以,tks。

解决方案 »

  1.   

    if(MessageBox(NULL,"关闭吗?","关闭",MB_YESNO)==IDYES)
    {
       OnOK();
    }
      

  2.   

    你想在C# 里调用C++ 代码? 那我的就行,因为我用了MFC 的OnOK();private void end_btn_Click(object sender, System.EventArgs e)
    {
     if (MessageBox.Show("确定退出系统?","结束",MessageBoxButtons.OKCancel,MessageBoxIcon.Question,MessageBoxDefaultButton.Button2) == MsgBoxResult.OK)
    {
    Close();
    }
                       else
                       {
                                  return;
                       }
    }
      

  3.   

    我这样在c#中(.net2005的版本)也不行啊,提示说:找不到类型或命名空间名称MsgBoxResult(是否缺少useing指令或程序集名称)。这是为什么啊,你那里是什么版本啊。help me。tks。