MessageBox with YesNoCancel - No & Cancel triggers same event

前端 未结 9 1092
误落风尘
误落风尘 2020-12-04 21:23

I have a message box with the YesNoCancel buttons...

  • Pressing Yes will do some action and close the application - works fine
相关标签:
9条回答
  • 2020-12-04 21:52

    The way I use a yes/no prompt is:

    If MsgBox("Are you sure?", MsgBoxStyle.YesNo) <> MsgBoxResults.Yes Then
        Exit Sub
    End If
    
    0 讨论(0)
  • 2020-12-04 22:03

    Try this

    MsgBox("Are you sure want to Exit", MsgBoxStyle.YesNo, "")
                    If True Then
                        End
                    End If
    
    0 讨论(0)
  • 2020-12-04 22:05

    Use:

    Dim n As String = MsgBox("Do you really want to exit?", MsgBoxStyle.YesNo, "Confirmation Dialog Box")
    If n = vbYes Then
        MsgBox("Current Form is closed....")
        Me.Close() 'Current Form Closed
        Yogi_Cottex.Show() 'Form Name.show()
    End If
    
    0 讨论(0)
提交回复
热议问题