条件和消息按钮

时间:2017-02-08 11:16:21

标签: vb.net

我有

if x<-1 and x>1 Then

[if that condition is not met, I want a Message saying "Hey, you need a number
between -1 and 1.]

End if

我该怎么做?

1 个答案:

答案 0 :(得分:1)

如果您只需要一个消息框,当x超出您的范围时弹出,请尝试: -

If x < -1 OrElse x > 1 Then
    MessageBox.Show("Hey, you need a number in the range of -1 and 1")
End If