界面上有两个控件:TEXTBOX1和TEXTBOX2程序中有一个变量ls_temp,运行时如果ls_temp=“TEXTBOX1”那么,我要将TEXTBOX1这个控件的TEXT改为“hello”,也就相当于TEXTBOX1.TEXT = "hello"
请问如何写,多谢!

解决方案 »

  1.   

    dim a as string
    text2_chang 
    a="asda"
    text1.text=a
      

  2.   

    理解错了
    ls_temp存放的是控件的名称,不是控件的TEXT属性
    如果ls_temp =“TEXTBOX1”,那么我要TEXTBOX1.TEXT = "hello"
    如果ls_temp =“TEXTBOX2”,那么我要TEXTBOX2.TEXT = "hello"
    我不想写死,想动态的根据ls_temp的值来改变相应控件的属性
      

  3.   

    dim ctl as control
        for each ctl in me
           if ctl.name=ls_temp then
               ctl.text="hello"
               exit for
           end if
        next
      

  4.   

    Dim ls_temp As String
    ls_temp = "Text1"
    Me.Controls(lw_temp).Text = "hello"