VB form的问题 谁来帮个忙

来源:百度知道 编辑:UC知道 时间:2024/06/23 01:41:06
form1上有个按钮
作用是关闭form1,打开form2
代码怎么写?
之前我弄的总是有问题,form2关闭了form1还在.

楼上的不好,因为hide只是隐藏,想完全关掉要把它卸载掉才行。

所以,应这样写:
Private Sub Command1_Click()
Unload Form1
Form2.Show
End Sub

这样就能实现关闭form1

Private Sub Command1_Click()
'加载Form2
Load Form2
'隐藏Form1
Form1.Hide
'显示Form2
Form2.Show

End Sub

Private Sub Command1_Click()
me.hide
Form2.Show
End Sub

Private Sub Command1_Click()
Unload Form1
Form2.Show
End Sub

Form2里 关闭事件里要使用End

Private Sub Form_Unload(Cancel As Integer)
Unload Form1
form2.Show
End Sub