1、公共模块
   Public CurrentImg As Image '定义当前图案为图像格式
2、在子窗体1中
   Set CurrentImg = Image(1)   ‘Image是一个图像数组
3、在主窗体中设置
   Set CurrentPic.Picture = map(1)  ‘map也是一个图像数组现在遇到的问题是:在第3步中,因为子窗体1已经关闭,而导致CurrentPic.Picture不能被引用。
所以问题是:如何判断CurrentPic.Picture能不能用,而后再决定赋值。

解决方案 »

  1.   

    if CurrentPic.Picture is nothing then exit sub
      

  2.   

    if CurrentPic.Picture is nothing then exit sub
      

  3.   

    我根本没看懂你在说什么
    你可以在主窗体这样设置子窗体里的picturebox吗?
    Set CurrentPic.Picture = map(1)?????? 
      

  4.   

    因为子窗体1已经关闭,而导致CurrentPic.Picture不能被引用。用For Each frm in Forms遍历所有窗体,检查子窗体1是否关闭就行了。
      

  5.   

    首先这不是一种良好的设计。
    其次无论哪个窗体设置了公共变量,就应该负责在 Unload 事件中清除公共变量。
      

  6.   

    http://zhidao.baidu.com/question/4762064.html