将VB中的Handles转为C#Handle

.Net技术 码拜 8年前 (2016-05-26) 1258次浏览
Private Sub num1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles numud1.ValueChanged _  , num2.ValueChanged, num3.ValueChanged
   //代码
End Sub

这个句柄用C#怎么写呢?

解决方案

5

先把num1_ValueChanged事件的功能写好,然后再添加下面代码的代码

this.num2.ValueChanged += new System.EventHandler(num1_ValueChanged);
this.num3.ValueChanged += new System.EventHandler(num1_ValueChanged);

35

绑定事件一般在类的构造函数中
public 构造函数()
{
this.numud1.ValueChanged += this.num1_ValueChanged;
this.num2.ValueChanged += this.num1_ValueChanged;
this.num3.ValueChanged += this.num1_ValueChanged;
}
private void num1_ValueChanged(System.Object sender, System.EventArgs e)
{
}

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明将VB中的Handles转为C#Handle
喜欢 (0)
[1034331897@qq.com]
分享 (0)