复选框的火灾事件 [英] Fire event of Checkbox

查看:68
本文介绍了复选框的火灾事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个复选框.我想在第一个复选框的checkdedChange上触发第二个复选框的checkedchange事件.

I have two checkboxes. I want to fire the checkedchange event of second checkbox on the checkdedChange of first checkbox.

推荐答案

您为什么建议这样做?唯一明智的方法是更改​​第一个事件处理程序中第二个CheckBox的已检查"状态.请注意,这可能需要进行真正的更改:true<-> false而不是"myCheckBox.Checked = true;",因为如果在将Checked状态设置为true之前,如果Checked状态为true,则更改的事件可能不会触发.
更好的方法是将相关代码放入可以从两个处理程序调用的单独方法中.
Why do you propose to do that? The only sensible way to do that is to change the Checked status of the second CheckBox in the event handler for the first. Note that this may require a real change: true <->false rather than "myCheckBox.Checked = true;" as the changed event may not fire if the Checked state is true before you set it to true.

The better way would be to put the relevant code into a separate method you can call from both handlers.


这篇关于复选框的火灾事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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