本文介绍了关闭主窗体后无法显示Form2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在从主表单显示登录表单时遇到问题.

代码:

I am facing issue with displaying login form from main form.

Code :

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       Dim frm2 As New Form2
       Me.Close()
       frm2.Show()
       Me.Show()
End Sub



这里的要求是mainform,必须在打开form2之前将其关闭,并且应该将其隐藏.如果它是隐藏的,则该项目根本不会关闭.当我使用me.close-时,它会放置对象,并且永远不会打开form2.
你能把我放下吗?

谢谢
Suresh Ch



Here the requirment is mainform has to be closed before opening the form2 and it should be hidden. if it''s hidden then the project is not closing at all. when I use me.close- it''s disposing the object and never opening the form2.
Could you please adivse me.

Thank you,
Suresh Ch

推荐答案


Dim frm2 As New Form2
frm2.Show()
Me.Hide()


这篇关于关闭主窗体后无法显示Form2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 17:43