如何与QUOT;未设置"事件 [英] How to "Unset" Event

查看:103
本文介绍了如何与QUOT;未设置"事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个组合框单击事件在designer.cs页,然后在程序运行中的某些点设置的基础上,一定条件下,我不再想组合框Click事件进行设置,我该怎么办未设置吗?我试着comboboxname.Click + = null,并且我已经尝试将其设置到另一个虚拟函数什么也不做......没有工作。

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 Click event to be set, how do I "unset" it? I've tried comboboxname.Click += null and I've tried setting it to another dummy function that does nothing...neither works.

推荐答案

设置:

comboBox.Click += EventHandler;

取消设置:

comboBox.Click -= EventHandler;

这篇关于如何与QUOT;未设置"事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆