比如我想判断一个控件数组是否相等
If Command1(0).Caption=1 And Command1(1).Caption=1 And Command1(2).Caption=1 Then
Print "A"
End If
如果Command1 控件有100个呢???怎么判断?? 难道要写100个 判断试?
我想有其他方法吧
请高手指点
你的意思是不是必須全部是caption為1才輸出A 要是這樣的話..可以像下面這樣做
for i=0 to 100
if command1(i).caption <> "1" then exit for
if i=100 and command1(100).Caption="1" then print "A" '少写了
怎么看 就这么别扭 原来你写错啦
别那么拿多 那8个来做实验
Dim i As Integer
Private Sub Command2_Click()
For i = 0 To 7
If Command1(i).Caption <> "1" Then Exit For
If i = 7 Then Print "A"
Next i
End Sub
如果全部等于1可以 输出A
Dim i As Integer
Private Sub Command2_Click()
For i = 0 To 7
If Command1(i).Caption <> "1" Then Exit For
Next i
If i = 7 Then Print "A"
End Sub
放上去者不行