您的位置:程序门 -> vb -> 基础类



关闭窗体的问题


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


关闭窗体的问题[已结贴,结贴人:lnwscn]
发表于:2007-01-08 11:08:42 楼主
我用
form2.show   1
在form1   上打开了一个窗体
此时form1在form2之下,不能被操作

我想在关闭form2的同时也关闭form1
可用了很多方法都不能实现
一执行
unload   form1
unload   form2
程序就死掉,是不是form2有焦点,所以不能被同时关闭
应该怎么做?怎么在form2里取消焦点?
发表于:2007-01-08 11:29:471楼 得分:0
unload   me
unload   form1
顺序问题
发表于:2007-01-08 13:43:412楼 得分:0
楼上正解
发表于:2007-01-08 13:44:353楼 得分:0
采取
me.hide
form1.hide
试试
发表于:2007-01-08 14:29:454楼 得分:0
private   sub   form_unload(cancel   as   integer)
stop
end   sub

在form2的unload事件中加入   stop
终止整个程序
试试~~
发表于:2007-01-08 19:32:445楼 得分:20
可以用下面代码,不论你关闭其中的哪个窗体,下面的所有窗体都关闭,并退出内存进程.
private   sub   form_unload(cancel   as   integer)
      if   not   form1   is   nothing   then
      unload   form1
      end   if
      if   not   form2   is   nothing   then
      unload   form2
      end   if
      if   not   form3   is   nothing   then
      unload   form3
      end   if

end   sub
发表于:2007-01-08 22:09:586楼 得分:0
楼上正确。
发表于:2007-01-09 17:58:217楼 得分:0
end


快速检索

最新资讯
热门点击