How to “Unset” Event

前端 未结 5 1073
醉酒成梦
醉酒成梦 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 16:02

     //to subscribe
     comboboxname.Click += ComboboxClickHandler; 
    
     //to conditionally unsubscribe
     if( unsubscribeCondition)
     {
       comboboxname.Click -= ComboboxClickHandler;
     }
    

提交回复
热议问题