我定义一条记录如下:
Type Test
      a1 as string
      a2 as string
End Type假设我有很多的Test变量,比如Test1,Test2,Test3..........
请问如何利用循环取得自定义变量中a1或a2的值dim Test1 as Test
dim Test2 as test
.....
dim Test10 as Testfor i=1 to 10
    print Controls(Test & str(i)).a1
next但这样运行有错误,请问如何解决?

解决方案 »

  1.   

    dim a(9) as Testfor i=0 to 9
        print a(i).a1
    next
      

  2.   

    定义成数组
    dim test(9) as test
    for i=0 to 9
      print test(i).a1
    next
      

  3.   

    使用数组dim TestArr() as Testredim TestArr(10)Dim i as integer
    for i=0 to Ubound(TestArr)
      ' Do something
    Next i
      

  4.   

    如果是多个一样的变量,建议定义成TEST数组。====================
    免费的学习交流网站,欢迎大家访问!
    http://www.j2soft.cn/
      

  5.   

    实在不能用数组的话,就用 Microsoft Script Control 1.0对象解决吧