标题:check判断
只看楼主
woa
Rank: 1
等 级:新手上路
帖 子:159
专家分:0
注 册:2008-12-4
结帖率:85.37%
 问题点数:0 回复次数:3 
check判断
If Check1.Value = Check2.Value = Check3.Value = Check4.Value = Check5.Value = Check6.Value = Check7.Value = Check8.Value = Check9.Value = Check10.Value = Check11.Value = Check12.Value = 1 Then
MsgBox "请不要乱选!"
ElseIf Check1.Value = Check2.Value = Check3.Value = Check4.Value = Check5.Value = Check6.Value = Check7.Value = Check8.Value = Check9.Value = Check10.Value = Check11.Value = Check12.Value Then
MsgBox "请选择类型!"
End If


为什么不要乱填的判断没有用

[ 本帖最后由 woa 于 2009-11-4 10:27 编辑 ]
搜索更多相关主题的帖子: 判断 check 
2009-11-03 23:44
msgj
Rank: 8Rank: 8
等 级:蝙蝠侠
威 望:4
帖 子:190
专家分:914
注 册:2009-10-3
得分:0 
你没有搞清逻辑关系,每个"="都有是一个逻辑判断,
(Check1.Value = Check2.Value) = (Check3.Value = Check4.Value) = 1 就是
(True = True) =1
True = 1  结果是 False
即使全部不选,如果是单数也会结果是 False
所以应该用 AND 进行逻辑判断:
If Check1.Value = 1 And Check2.Value = 1 And Check3.Value = 1 And Check4.Value = 1 And Check5.Value = 1 And Check6.Value = 1 And Check7.Value = 1 And Check8.Value = 1 And Check9.Value = 1 And Check10.Value = 1 And Check11.Value = 1 And Check12.Value = 1 Then
MsgBox "请不要乱选!", vbInformation + vbOKOnly, "提示"
ElseIf Check1.Value = 0 And Check2.Value = 0 And Check3.Value = 0 And Check4.Value = 0 And Check5.Value =  0 And Check6.Value = 0 And  Check7.Value = 0 And  Check8.Value = 0 And  Check9.Value = 0 And  Check10.Value = 0 And  Check11.Value = 0 And  Check12.Value = 0 Then
MsgBox "请选择类型!", vbInformation + vbOKOnl y, "提示"
End If

2009-11-04 06:58
multiple1902
Rank: 8Rank: 8
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
注 册:2007-2-9
得分:0 
谁教你可以连等了?
2009-11-04 08:10
woa
Rank: 1
等 级:新手上路
帖 子:159
专家分:0
注 册:2008-12-4
得分:0 
了解了
2009-11-04 10:26



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-290935-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.166682 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved