MessageBox Show 只接受两个参数,但我需要第三个参数

MesageBox Show only accepts two arguments, but I need a third argument

我需要通过显示 MessageBox.Show("Caption", "Title", MessageBoxDialog) 来显示确认对话框,但是出现错误 "Error 1 Overload resolution failed because no accessible 'Show' accepts this number of arguments"

已经尝试在互联网上查看其他一些代码,但总是出现相同的错误。

这是从 dotnetperls.com

复制的
`   Dim result1 As DialogResult = MessageBox.Show("Is Dot Net Perls awesome?", "Important Question", MessageBoxButtons.YesNo)`

这个目前在我的代码中,从 MessageBox with YesNoCancel - No & Cancel triggers same event

复制而来
 `Dim result As Integer = MessageBox.Show("message", "caption", MessageBoxButtons.YesNoCancel)
    If result = DialogResult.Cancel Then
        MessageBox.Show("Cancel pressed")
    ElseIf result = DialogResult.No Then
        MessageBox.Show("No pressed")
    ElseIf result = DialogResult.Yes Then
        MessageBox.Show("Yes pressed")
    End If`

从我以前以为丢失的代码:

If confirm = MsgBoxResult.Yes Then Dim reConfirm As MsgBoxResult = MsgBox("YOU ARE REALLY SURE?", MsgBoxStyle.YesNo) If reConfirm = MsgBoxResult.Yes Then End If End If

变体 1


Dim result = MsgBox("Message" , MsgBoxStyle.YesNoCancel, "Caption")
Select Case result
    Case MsgBoxResult.Yes
      MsgBox("Yes pressed")   
    Case MsgBoxResult.No
      MsgBox("No pressed")   
    Case MsgBoxResult.Cancel
      MsgBox("Cancel pressed")   
End Select

变体 2

Dim result = MessageBox.Show("Message", "Caption", MessageBoxButtons.YesNoCancel)
If result = DialogResult.Cancel Then
    MessageBox.Show("Cancel pressed")    
ElseIf result = DialogResult.No Then
    MessageBox.Show("No pressed")    
Else
    MessageBox.Show("Yes pressed")    
End If