在c#windows应用程序中关闭Form2之后运行(Form1_Load)? [英] run (Form1_Load) after close Form2 in c# windows application?
本文介绍了在c#windows应用程序中关闭Form2之后运行(Form1_Load)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
请
我的c#窗口中有两张表格申请
主要表格是(Form1)
当我点击按钮时我打开(Form2)
我试着刷新我关闭Form2后重新加载Form1
我该怎么办:)
请帮助:)
Hi All
please
I have two Forms in my c# windows Application
the main form is (Form1)
when I click on button I open (Form2)
I try to refresh or reload Form1 after I close Form2
how can I do that :)
please help :)
推荐答案
您无需刷新或重新加载表单。如果您关闭了表单,则无法再次打开它,因为它会被丢弃。而是调用Form1.Hide()
然后调用Form1.Show()
。
这与Form1_Load
完全无关;如果你不想拥有它,你甚至不需要这种方法;它必须是事件的处理程序Form.Load
,但是,正式地说,你的帖子中没有任何内容告诉它;你知道只有当某个事件实例上的运算符'+ ='被显示时,某些方法才被用作处理程序。
永远不要使用自动生成的名称,如Form1中
;它们不是为了永久使用而违反(良好)Microsoft命名约定;更糟糕的是,它们没有语义;你应该以语义合理的方式重命名所有内容:MainForm
,SplashScreenForm
等等。
-SA
You don't need to "refresh or reload" a form. If you closed a form, you cannot open it again, because it becomes disposed. Instead callForm1.Hide()
and later callForm1.Show()
.
This is totally unrelated toForm1_Load
; you don't even need this method, if you don't want to have it; it must be the handler of the eventForm.Load
, but, formally speaking, nothing in your post tells as about it; you know that some method is used as a handler only if the operator '+=' on some event instance is shown.
And never use auto-generated names likeForm1
; they are not intended for permanent use and violate (good) Microsoft naming conventions; worse, they carry no semantics; you should rename everything in semantically sensible way:MainForm
,SplashScreenForm
and the like.
—SA
这篇关于在c#windows应用程序中关闭Form2之后运行(Form1_Load)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文