单击按钮是否可以调用页面加载事件? [英] Is this possible to call page load event on button click?

查看:74
本文介绍了单击按钮是否可以调用页面加载事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在C#.Net窗口表单应用程序中单击按钮时调用页面加载事件.

Is this possible to call page load event on button click in C#.Net window form application.

推荐答案

只需要将空值传递给form_load事件

just need to pass null values to your form_load event

this.Form1_Load(null,null);


您可以从任何其他事件或方法中调用任何方法或事件.

如果您不处理senderEventArgs,只需传递null值即可.
You can call any method or event from any other event or method.

if you are not handling the sender and EventArgs just pass null values.


protected void Page_Init(object sender, EventArgs e)
{
      Button1.Click += new EventHandler(Button1_Click);
}

 void Button1_Click(object sender, EventArgs e)
{
}



尝试此方法,但适用于Web应用程序



Try this one, but its for web application


这篇关于单击按钮是否可以调用页面加载事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆