在 form1中有一个 command1 和一个textbox1 
在 form2中有一个 command2 和一个textbox2 
在 form3中有一个 command3 和一个textbox3 
...
在 form_n中有一个 command_n 和一个textbox_N
那么,我在点击任意一个窗体中的 command时,显示同一个窗体 SomeForm,
在窗体someform结束前,改变那个显示someform窗体的某个textbox 的内容不采用select case 形式的判断,而是期待类似c语言中指针的东西,
高手指点。

解决方案 »

  1.   

    '通過傳遞參數地址來返回一個新的值private sub command1_click()
        dim strText as string
        '調用SomeForm改變strText的值.
        call SomeForm.formshow(strText)
        text1.text = strText
    end sub
    '在SomeForm中定義一個公共接口供其它調用本Form
    public sub formshow(byref strText as string)
        me.show vbmodal
        strText = "NewText"
    end sub
      

  2.   

    在那个someForm中写下列代码:
    '声明一个窗体对象
    private objForm as form 
    '当在每个窗体中调用someForm窗体时,call 下面的sub把load它的form传进someForm中去
    public sub inForm(inF as form)
       set objForm = inF
    end sub在窗体的unload事件中写入下列代码,修改text1的值
       objForm.text1.text = "这里是你想写入的内容"上面只是一个思路
    目的是告拆someForm是从个窗体中load的
    然后在someForm的unload中修改这个窗体的text1的text值