有什么办法可以传递“方法”?? myButton.Click+=new System.EventHandler(Btn_Click);就可以啊!!还是你有其它意图?说清楚点 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 委托,DELEGATE可以呀! 如果你想在Add()方法中调用Btn_Click,方法是:[VB]AddHandler myButton.Click, AddressOf Me.Btn_Click[C#]myButton.Click += new System.EventHandler(this.Btn_Click); 这问题已经解决啦!http://www.csdn.net/Expert/TopicView1.asp?id=555264谢谢大家!回复人: chechy(我爱洁洁) ( ) 信誉:110 2002-3-5 10:36:48 得分:20 作为参数,似乎只能这样: public void Add(EventHandler a) { button2.Click += a; } Add(new EventHandler(button3_Click)); delegate void EventFunction(object sender,EventArgs e);public void add(EventFunction function) { Button myButton=new Button(); myButton.Name="asdf"; myButton.Location=new Point(20,20); myButton.Click+=new System.EventHandler(function); } public void Btn_Click(object sender,System.EventArgs e) { .... }EventFunction eventFunction+=new EventFunction(Btn_Click);add(eventFunction) c#解析xml 删除相同数据并且记录个数 ===向大家求教一个关于TextBox的问题=== 看见月亮成猩猩,按国际惯例低调散分,见者有份 进一步..c#循环添加 HtmlTableCell[][] td 的问题 胖客户端访问数据库服务器,怎么办?? 我现在想用VS2005 C#EXPERSS开发程序发行可不可以?为什么? C# 用dataet 更新数据问题 十万火急的问题 请帮我分析一下我的post请求头的构造,是否保持一致。 有关DropDownList的问题? 我现在开始学C#!
委托,DELEGATE可以呀!
[VB]
AddHandler myButton.Click, AddressOf Me.Btn_Click[C#]
myButton.Click += new System.EventHandler(this.Btn_Click);
谢谢大家!回复人: chechy(我爱洁洁) ( ) 信誉:110 2002-3-5 10:36:48 得分:20
作为参数,似乎只能这样:
public void Add(EventHandler a)
{
button2.Click += a;
}
Add(new EventHandler(button3_Click));
public void add(EventFunction function)
{
Button myButton=new Button();
myButton.Name="asdf";
myButton.Location=new Point(20,20);
myButton.Click+=new System.EventHandler(function);
}
public void Btn_Click(object sender,System.EventArgs e)
{
....
}
EventFunction eventFunction+=new EventFunction(Btn_Click);
add(eventFunction)