为了实现msgbox类似的窗体,创建了两个form1,form2.
form2就有一个label上面放message的。form1_load事件里
   if flag = false then
       form2.label = "cuowu"
       form2.show 1,me
       exit sub
    end if   if flag2 = false then
       form2.label = "buxing"
       form2.show 1,me
       exit sub
    end if    下面赋值。
end sub为什么窗体form2显示以后,然后点击form2的关闭按钮。代码继续执行下去。
exit sub没有什么作用。用unload me也没有用。      

解决方案 »

  1.   

    form1_load事件里
      if flag = false then
      form2.label = "cuowu"
      form2.show 1,me
      exit sub
      end if  if flag2 = false then
      form2.label = "buxing"
      form2.show 0,me
      me.hide
      exit sub
      end if  下面赋值。
    end sub
      

  2.   

    me.hide
      

  3.   

    LZ你好好看看你的代码,你的代码中没有卸载Form1的代码,当然,关闭Form2后form1还显示着,但是实际上Exit sub已经执行过了,不信的话,你自己调试一下看看
    如果在form2.show 1,me 后加上Unload Me的话,关Form2后form1就不显示了。
      

  4.   

    把这两个判断写在Form_Activate事件里
      

  5.   

    Private Sub Form_Activate()
        Form2.Show 1
        If Form2.Visible = False Then
            Unload Me
        End If
    End Sub