If Downloader1(0).ttt = True And Downloader1(1).ttt = True And Downloader1(2).ttt = True And Downloader1(3).ttt = True And Downloader1(4).ttt = True And Downloader1(5).ttt = True Then GoTo rr1 Else GoTo rr请问如何节俭一些!
因为控件数组不一定是多些!

解决方案 »

  1.   

    Dim i   As Long
        Dim b As Boolean
        
        For i = Downloader1.LBound To Downloader1.UBound
            If Downloader1(i).ttt Then
                b = True
                Exit For
            End If
        Next i
        
        If b Then
            GoTo rr1
        Else
            GoTo rr
        End If
        
      

  2.   

    或者把你原来代码中的 =True 全部去掉,这样也行的
      

  3.   

    dim i as long
    for i = LBound(downloader1) to UBound(downloader1)
        if downloader1(i).ttt=true then
             GoTo rr1 Else GoTo rr
        End If
    next
      

  4.   

    Option Explicit
    Dim flag As Boolean
    Private Sub Command1_Click()
    flag = False
      Dim i As Long
      For i = LBound(downloader1) To UBound(downloader1)
        If downloader1(i).ttt = False Then
           flag = True
           GoTo rr1
        End If
       
    Next If flag = False Then GoTo ErrEnd Sub
      

  5.   

    //或者把你原来代码中的 =True 全部去掉,这样也行的//都不行啊!If Downloader1(0).ttt = True And Downloader1(1).ttt = True And Downloader1(2).ttt = True And Downloader1(3).ttt = True And Downloader1(4).ttt = True And Downloader1(5).ttt = True Then GoTo rr1 Else GoTo rr等价于:
    If Downloader1(0).ttt And Downloader1(1).ttt And Downloader1(2).ttt And Downloader1(3).ttt  And Downloader1(4).ttt And Downloader1(5).ttt  Then GoTo rr1 Else GoTo rr怎么会不行
      

  6.   

    为什么不用: zou19820704(国际海员)的呢?我觉得那样写很好呀.
      

  7.   


    for each p in controls("Downloader1")
      if p.ttt=false then GoTo rr1  
    next 
    GoTo rr
      

  8.   

    不好意思上面反了
    for each p in controls("Downloader1")
      if p.ttt=false then GoTo rr  
    next 
    GoTo rr1
      

  9.   

    推荐用楼上的,另外wzzwwz(棒子面窝头) 的代码逻辑上弄反了。
      

  10.   

    //推荐用楼上的,另外wzzwwz(棒子面窝头) 的代码逻辑上弄反了。
    不好意思,弄反了。。楼主用其他简单的吧。。