Private Sub Form_Load()
if Me.txt_ksfs.Text=Me.txt_psfs.Text then
'
Else
   xx = MsgBox("失败", 48, "信息提示")
   Unload Me
   
   End If
End Sub
怎么else失败就出错误,代码怎么改呀unload me不能这么关闭吗?

解决方案 »

  1.   

    在 Form_Load 事件中,不能用 Unload Me 卸载自己
    建议你这么做
    在 Form1.Show 前Load Form1
    if Form1.txt_ksfs.Text=Form.txt_psfs.Text then
        Unload Form1
    else
        Form1.Show
    end if另外,你题目上的问题,如果没有什么特别的要求,把
    ControlBox 设为 False
      

  2.   

    看错了,是这样在 Form_Load 事件中,不能用 Unload Me 卸载自己
    建议你这么做
    在 Form1.Show 前Load Form1
    if Form1.txt_ksfs.Text=Form1.txt_psfs.Text then
        Form1.Show
    else
        xx = MsgBox("失败", 48, "信息提示")
        Unload Form1
    end if