希望在窗体加载事件中加载一个按钮点击事件 private void PhoneLoad(object sender, RoutedEventArgs e)
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
}为什么会出现No overload for 'btn_Click' matches delegate 'System.EventHandler'
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
}为什么会出现No overload for 'btn_Click' matches delegate 'System.EventHandler'
private void Button1_Click(object sender, RoutedEventArgs e)
{ textBox.text="hello!" }
大概是这样应该如何传递呢
你需要指定sender和e这两个参数的值.
e1=new Eventargs();
private void Button1_Click(object sender, RoutedEventArgs e)
{ textBox.text="hello!"; }可以具体一个实例麽 如果Button1_Click是这样的话 应该如何写sender1和e1
{
this.Button1.Click += new System.RoutedEventHandler(this.Button1_Click);
}没想到你是wpf/silverlight。既然是这个,那么这里你去模仿winfrom使用EventHandler是不对的。
private void PhoneLoad(object sender, RoutedEventArgs e)
{
this.Button1.Click += new System.Windows.RoutedEventHandler(this.Button1_Click);
}