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)
{
}
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)
{
}