如何使用C#动态事件调用另一个函数 [英] How to dynamic Event call to another function using c#
本文介绍了如何使用C#动态事件调用另一个函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
TreeView1.TreeNodePopulate += new TreeNodeEventHandler(this. TreeView1_TreeNodePopulate);
但是此代码无法正常工作先生,很紧急
推荐答案
TreeView1.TreeNodePopulate + = someMethod ;
TreeView1.TreeNodePopulate += someMethod;
为此事件创建一个函数.试试这个:
Create a function for this event. Try this:
protected void TreeView1_TreeNodePopulate(object sender, EventArgs e)
{
//Do your stuff
//Again if you want to call a function then try this
fnTestFunction();
}
private void fnTestFunction()
{
//stuff for function
}
--Amit
--Amit
这篇关于如何使用C#动态事件调用另一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文