下面是我的MsgBox代码." 是"按钮正在工作,但是当我单击" 否"或" 取消"时,它仍然会删除数据...
strup = "DELETE FROM student WHERE urno =" & CInt(txtUrn.Text) & ";"
Dim command As New OleDb.OleDbCommand(strup, con)
MsgBox("Do you want to delete record(s)", MsgBoxStyle.YesNoCancel, "Confirm Delete")
command.ExecuteNonQuery()
con.Close()
Run Code Online (Sandbox Code Playgroud)
单击" 否"或" 取消"时如何取消删除操作?
使用基本If声明.该MsgBox不会取消任何东西.
If MsgBox("Prompt", MsgBoxStyle.YesNoCancel, "Title") = MsgBoxResult.Yes Then
' execute command
End If
Run Code Online (Sandbox Code Playgroud)
您还可以使用MsgBoxStyle.YesNo仅获得"是"和"否"按钮.
| 归档时间: |
|
| 查看次数: |
66466 次 |
| 最近记录: |