IntelliSense不显示MessageBoxResult [英] IntelliSense not showing MessageBoxResult

查看:73
本文介绍了IntelliSense不显示MessageBoxResult的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在C#和Visual Studio 2005中使用Windows窗体应用程序.

I am working with a Windows Forms application in C# and Visual Studio 2005.

我正在按钮单击事件中显示一个消息框,

I am showing a message box within an button click event,

string messageBoxText = "Click OK to save your changes\n";
string caption = "Confirm Changes";
MessageBoxButtons button = MessageBoxButtons.OKCancel;
//Display the MessageBox
MessageBox.Show(messageBoxText, caption, button);

MessageBoxResult result = MessageBox.Show(messageBoxText, caption, button);

编译时会弹出以下错误:

The following error pops up on compilation:

错误1找不到类型或名称空间名称'MessageBoxResult'(您是否缺少using指令或程序集引用?)

Error 1 The type or namespace name 'MessageBoxResult' could not be found (are you missing a using directive or an assembly reference?)

此外,IntelliSense不会显示任何诸如MessageBoxResult之类的东西.我已经在MSDN上看到了此声明.如何在不使用MessageBoxResult的情况下捕获消息的响应(确定/取消)?

Also, IntelliSense does not show any such thing as MessageBoxResult. I have seen this statement on MSDN. How to capture the response of the message (OK/Cancel) without using MessageBoxResult?

推荐答案

The MessageBoxResult Enumeration is only available on .NET 3.0+. You're using 2.0.

按照Walt建议使用DialogResult.

Use DialogResult as Walt suggested.

这篇关于IntelliSense不显示MessageBoxResult的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆