值为0 则软件停止运行的vb代码怎么写

来源:百度知道 编辑:UC知道 时间:2024/05/22 08:54:50
例如 你在一个文本框中输入数字0 然后点击运行按钮 弹出一个提示错误的对话框 这个代码如何写啊
用vb 谢谢

Private Sub Command1_Click()
if text1.text ="0" then
msgbox "错误数值不能为0",16,"错误:" ’提示错误
exit sub '退出程序
end if
'后面写如果不为0的时候你要进行的操作
end sub

if text1.text="0" then

msgbox "运行错误"

unload me

end if

If text1.Text = "0" Then MsgBox "错误", 0 + 16

if text1.text ="0" then
msgbox "错误"
end if