【问题标题】:button Cancel not show in messagebox按钮取消不在消息框中显示
【发布时间】:2012-02-23 22:40:48
【问题描述】:

我有一些问题。当我运行这个项目时,只有消息框按钮 ok 出现,但按钮取消不显示。 我正在使用 Visual Basic Express Edition 2008。这是我的编码。

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        If MessageBox.Show("Sila Pastikan Data MyKad Anda." & vbNewLine & vbNewLine & "Nama:" & TextBox1.Text & vbNewLine & "No I/C: " & icTextBox.Text &, MessageBoxButtons.OKCancel) = MsgBoxResult.Cancel Then
            ' nothing
        Else
            MessageBox.Show("ok")
        End If
End Sub

【问题讨论】:

    标签: vb.net


    【解决方案1】:

    您正在尝试将 Show() 与 MessageBoxButtons 设置一起使用,但该调用需要 3 个参数。尝试为通话添加标题;

    If MessageBox.Show("Are you sure to edit Student data with Id." & vbNewLine & vbNewLine & "Name:" & TextBox1.Text & vbNewLine & "No ID: " & idTextBox.Text, "Title", MessageBoxButtons.OKCancel) = MsgBoxResult.Cancel Then
        ' nothing
    Else
        MessageBox.Show("ok")
    End If
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-04-10
      • 2012-02-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多