我正在使用Visual Studio 2008开发Windows CE应用程序。
码:
private void cmdLogOn_Click(object sender, EventArgs e)
{
if (loginStatus == false)
{
DialogResult dialogresult = MessageBox.Show("Are you sure?", "text", MessageBoxButtons.YesNo);
if (dialogresult == DialogResult.Yes)
{
//Do Stuff;
}
}
else
{
//Do stuff
}
}
我收到错误:“没有重载方法'显示'需要'3'参数”。知道为什么吗?
编辑:这是一步一步使用新的应用程序来证明问题:
2.Visual C#>智能设备项目
button1
和一个标签= label1
简单的答案是在.NET Compact框架中,没有重载需要3个参数,正如错误所说。
你可以用这个:
DialogResult dialogresult = MessageBox.Show("Are you sure?", "text",
MessageBoxButtons.YesNo, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
一个合理的解释是你的目标是.net 1,对于紧凑的框架,它只有一个qazxsw poi。
支持single MessageBox.Show
method that accepts a single parameter of type string
,至少从文档中可以看出。
您在评论中说明您正在使用.net 3.5。在这种情况下,唯一合理的结论是compact framework for the overload that you seek to use was added in .net 2.0必须是MessageBox
之外的东西,因为在紧凑框架上的.net 3.5中的那个类具有你想要调用的超载。
最后,@ CAThalMF断言紧凑框架中不存在重载。也许文档是错的!
你可以尝试这样的事情:
System.Windows.Forms.MessageBox
MessageBox.Show("my text", "title", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation,
MessageBoxDefaultButton.Button1);
你必须使用Source
System.Windows.Forms