我想在程序里实现对 text1.text 或者 text2.text 的动态调用
如 dim i as integer
   text i ="ssss" 
  '大致就这个意思,但是不需要创建控件数组如text1(0),text1(1)....
怎么实现大家给指点一下

解决方案 »

  1.   

    dim obj as object
    dim i as integerfor each obj in form1
        for i = 1 to 2
            if obj.name = "Text" & i then
                obj.text = "ssss"
            endif
        next i
    next
      

  2.   

    dim obj as object
    dim i as integerfor each obj in form1
        if typeof obj is TextBox then  '提高一点效率
            for i = 1 to 2
                if obj.name = "Text" & i then
                    obj.text = "ssss"
                endif
            next i
        endif
    next