【问题标题】:Can we code on mesaage box buttons in vb.net?我们可以在 vb.net 中的消息框按钮上编码吗?
【发布时间】:2019-12-08 12:18:31
【问题描述】:

我想在 vb.net 中的消息框按钮上编写代码。单击时它应该执行我选择的特定任务

【问题讨论】:

标签: vb.net


【解决方案1】:

您可以检查DialogResult 以执行MessageBox 上可用的不同按钮的特定代码。请参阅以下示例:

Dim dlgResult As DialogResult = MessageBox.Show("Your Message", "Your Caption", MessageBoxButtons.YesNo)

If dlgResult = System.Windows.Forms.DialogResult.Yes Then
  'Code on Yes
ElseIf dlgResult = System.Windows.Forms.DialogResult.No Then
  'Code on No
End If

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-04-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多