如何隐藏启动表单并显示替代表单 [英] How to hide startup form and show alternative form
问题描述
我已经在vb.net中创建了一个应用程序,该应用程序询问是否输入密码,然后显示相关表格,但我遇到了问题,我无法隐藏启动表格.
我正在启动表单中使用表单加载
i have created an application in vb.net which asks a password if password write then it shows the related form but i am having a problem i am not able to hide the start up form
i am using in form load in start up form
EnterPassword.show()
me.hide()
没有任何效果
所以我用了替代代码
with this no effect
so i used alternative code
EnterPassword.show()
me.Close()
这导致整个应用程序终止
因此,请帮助我
this cause whole application terminated
so please help me
推荐答案
不要隐藏任何形式,如果它没有用,那么最好使用代码卸载该形式
实现这样的模块
do not hide any form if it is of no use you better unload the form use the code
implement a module like this
Module App
<STAThread()> _
Public Sub Main()
Application.EnableVisualStyles()
Application.DoEvents()
Application.Run(New Loginform()) 'implement login logic here
Application.Run(New Form2())
End Sub
End Module
将sub main设置为启动对象.您的登录表单将自动卸载,并在其后显示form2
set sub main as your startup object. your login form will automatically unload and form2 will appear after it
这是正确的代码
it is correct code
EnterPassword.show()
me.hide()
Me.Opacity = 0
并设置启动表单的属性 ShowInTaskbar = False
祝您编码愉快!
:)
and set your startup form''s property ShowInTaskbar=False
Happy Coding!
:)
这篇关于如何隐藏启动表单并显示替代表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!