我如何重新填写表格 [英] how can i relod the form
本文介绍了我如何重新填写表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何显式调用表单的form_load事件....
how can i call the form_load event of the form explicitly ....
推荐答案
您可以使用 ^ ]方法.
否则,一个肮脏的技巧是将所有初始化代码放入方法中,而不是构造函数或Form.Load事件中,然后仅调用该方法.这也可以包括设计器生成的InitializeComponent()方法,该方法在窗体上设置所有控件.不过,您应该删除该窗体上的所有控件,这是该方法中的第一个操作.
You can use the Refresh [^]method.
Else, a dirty trick would be to put all your initialization code into a method and not the constructor or the Form.Load event and just call that method. This can also include the designer-generated InitializeComponent() method which sets up all controls on the form. You should remove all controls on the form as your first action in that method, though.
任何具有signature
的方法
Any method which is has asignature
private void Form1_Load(object sender, System.EventArgs e)
分配给Form
的Load event
,如此处http://msdn.microsoft.com/en-us/library/system.windows.forms.form.load.aspx [ ^ ]
如果method
具有public visibility or access
,则可以通过传递如下所示形式的实例从Form
的instance
调用它
can be assigned to the Load event
of the Form
as explained here http://msdn.microsoft.com/en-us/library/system.windows.forms.form.load.aspx[^]
If the method
has public visibility or access
then it can be called from the instance
of the Form
by passing the instance of the form as shown below
Form1.Form1_Load(Form1, EventArgs.Empty);
这篇关于我如何重新填写表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文