关于vb语句的问题。我是初学者…………
来源:百度知道 编辑:UC知道 时间:2024/05/19 21:57:44
我想写一条条件语句,但是写出来好像不对。
假设有:条件 a,b,c,d 。我想写:当a成立 或 b且c成立 时,d为真。我是这么写的:if a=1 or (b=1 and c=1) then d=1
但是实现不了。请高手指点我该怎么改?谢谢!
假设有:条件 a,b,c,d 。我想写:当a成立 或 b且c成立 时,d为真。我是这么写的:if a=1 or (b=1 and c=1) then d=1
但是实现不了。请高手指点我该怎么改?谢谢!
我试了你的方法,可行
Dim a, b, c, d As Boolean
a = True
b = True
c = True
d = False
If a = True Or (b = True And c = True) Then
d = True
End If
如果你怕不保险,就多写一个条件判断
Dim a, b, c, d As Boolean
a = True
b = True
c = True
d = False
If a = True Then
If b = True And c = True Then d = True
End If
你要把变量设置为Boolean类型的。
Dim a as Boolean
Dim b as Boolean
Dim c as Boolean
Dim d as Boolean
If a = True Then
d = True
End If
Else
If c = True and d = True then
d = True
End If
End If
If a Or (b And c) Then d = True
* VB中的Ture不等于1,False不等于0