0

I need to have a confirmation dialog box by showing MessageBox.Show("Caption", "Title", MessageBoxDialog), but an error occurred "Error 1 Overload resolution failed because no accessible 'Show' accepts this number of arguments"

Already tried to check some other codes in the internet, but its always with the same error.

This was copied from dotnetperls.com

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

and this one is currently in my code, copied from 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`
Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536

2 Answers2

0

From my previous code which I thought I lost:

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

0

Variant 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

Variant 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

Ess Kay
  • 598
  • 4
  • 20