而如果执行dim aa as new form1
set aa=nothing
则系统不会执行,这是为何?????????????
我看了下msdn,上面说form1实际上是个隐含的全程变量引用
类似等于dim form1 as new form1.
----------------------------------
请问如果是那样的话set form1=nothing就失去意思了啊!!!
使用unload me
然后set form1=nothing
好象是无法彻底释放form1相关的内存和资源
---------------------------------------------
我想过了如果是那样的话我就会
使用(菜单中)dim aa as new form1
aa.show
.......
最后退出表单使用
unload me
set aa=nothing
------------------------
但我想请问如果我要通过form2上command1_click为该表单text1赋值如:aa.text1.text="yang"好象就不行.我该如何处理.
难到我还要为aa赋public吗??

解决方案 »

  1.   

    说的是啥?我的Form1是启动Form,如果是从sub main(),就没你说的问题。
      

  2.   

    实际上我指的是dim aa as new form1
    aa.show
    -------------------(以上代码肯定在菜单中实现)
    但请问如果再
    unload me
    set aa=nothing
    (aa是局部变量,好象只有把aa设置为public才能在表单中用set aa=nothing)
    还有没有其他方法实现该功能
    -----------------------------------
    其二我想说的是直接使用unload me ,set form1=nothing并不能彻底释放form1相关的内存和资源.因为set form1=nothing后,form1仍然会被重新创建.
    大家看看msdn中的"Visual Basic 窗体的存活期"
      

  3.   

    没有看到你的实际代码,具体问题在哪里不太清楚。你可以把set aaa=nothing写在前面再写unload me试一下。