How to “Unset” Event

前端 未结 5 1072
醉酒成梦
醉酒成梦 2021-01-19 15:10

If I have a combobox click event set in the designer.cs page and then at some point during the running of the program, based on some condition, I no longer want the combobox

5条回答
  •  执念已碎
    2021-01-19 15:50

    Assuming your handler is assigned like this:

    this.comboBox1_Click += new System.EventHandler(this.comboBox1_Click);
    

    disable it like this:

    this.comboBox1.Click -= new System.EventHandler(this.comboBox1_Click);
    

提交回复
热议问题