How to add event handler for dynamically created controls at runtime?

前端 未结 3 576
独厮守ぢ
独厮守ぢ 2020-11-28 15:34

I am working on C# windows application. my application get controls(button,text box,rich text box and combo box etc)from custom control library and placed them into form dyn

3条回答
  •  隐瞒了意图╮
    2020-11-28 15:57

    var t = new TextBox();
    t.MouseDoubleClick+=new System.Windows.Input.MouseButtonEventHandler(t_MouseDoubleClick);
    
    private void t_MouseDoubleClick(object sender, MouseButtonEventArgs e)
    {
         throw new NotImplementedException();
    }
    

    It's adding double click eventhandler to new TextBox

提交回复
热议问题