“Public Function MsgBox ...”的参数太多了

时间:2017-06-05 13:48:20

标签: vb.net vb.net-2010

我有这样的错误:

  

'公共函数MsgBox的参数太多(提示为对象,[按钮为Microsoft.VisualBasic.MsgBoxStyle = MsgBoxStyle.OkOnly],[Title As Object = Nothing])作为Microsoft.VisualBasic.MsgBoxResult'。

我的代码是这样的:

string javascript = $"$(window.open('', '_blank', 'location=yes'))";

((IJavaScriptExecutor)Driver).ExecuteScript(javascript); //create new window

Driver.SwitchTo().Window(Driver.WindowHandles.Last())); //switch to new window

//do download test here

Driver.Close(); //close created window

Driver.SwitchTo().Window(Driver.WindowHandles.First()); //back to original window with no download bar

我不知道为什么会出现这种错误。我错过了什么吗?

1 个答案:

答案 0 :(得分:1)

使用正确的MessageBox.Show重载(而不是遗留的MsgBox函数),它应该如下所示:

If MessageBox.Show("Are you sure?", "Logout", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
    Form6.ShowDialog()
    Me.Close()
End If
相关问题