2012-02-17 60 views
0

我有一些問題。當我運行這個項目,只有消息框按鈕確定出現,但按鈕取消不顯示。 我使用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 

回答

0

您試圖使用帶有MessageBoxButtons設置的Show(),但該調用需要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 
+0

好的非常感謝你,工作很好。 :) – ieyla 2012-02-17 08:03:32