在vb.net中隐藏表单........... [英] Form Hide in vb.net...........
本文介绍了在vb.net中隐藏表单...........的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个表格
其Form1和Form2 :)。
和第一个表格show是程序运行时的form1
我想知道如何在我的form1隐藏时执行命令或运行代码。
有人能帮帮我吗?因为我无法在活动中找到任何东西..
这是紧急ty.ty.ty.
请帮助
I have two forms
its Form1 and Form2 :).
and the first will show is the form1 when the program is running
I just wanna ask how to execute a command or run a code when my form1 hides.
can somebody help me? because i cant find anything in the form events..
this is urgent ty.ty.ty.
pls help
推荐答案
<$有什么问题c $ c> Form.Show ,Form.Hide
?
这里: http://msdn.microsoft.com/en-us/library/system。 windows.forms.form.aspx [ ^ ]。
但是,我觉得您的应用程序设计中存在滥用行为,这对于尚未使用的人来说是很自然的隐藏或显示表单。有可能,你需要检查它。如果你解释为什么要这样做,你可以得到更多的帮助。
之后OP的澄清:
隐藏一个表格并展示另一个表格不是一个好主意。如果您不再使用它,为什么要隐藏一个表单。一种模式是这样的:
What's wrong withForm.Show
,Form.Hide
?
Here: http://msdn.microsoft.com/en-us/library/system.windows.forms.form.aspx[^].
However, I feel the abuse in your application design, which is only natural for a person who did not yet hide or show a form. Chances are, you will need to review it. You could get more help if you explain why would you do it.
After OP's clarification:
It's wasn't a good idea to hide one form and show another. Why hiding one form if you are not going to use it any longer. One pattern would be like this:
' in entry-point method (Main):
Dim mainForm As Form = New FormMain()
Dim loginForm As Form = New FormAuthentication()
' implement AuthenticationFailed property
loginForm.ShowDialog()
If loginForm.AuthenticationFailed Then
Return
End If
' application terminates, the user can tray again
' authentication successful:
Application.Run(mainForm)
在更复杂的变体中,你可以给用户很少的尝试等等......
这篇关于在vb.net中隐藏表单...........的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文