The problem that best thinking cannot ride elder sister-is it a control bug?

Source: Internet
Author: User

I entered the topic directly and became confused for one afternoon.

Functions to be implemented:

Checkedlistbox control of winform

Click "all" and select all. However, if you click too fast, the above phenomenon will occur. The following options are not selected.

The Code is as follows:

Private void clbsaledept_selectedindexchanged (Object sender, eventargs e) {checkedlistbox cb = sender as checkedlistbox; If (cb = NULL | CB. selectedindex <0) {return;} // if you click "select all" If (CB. selectedindex = 0) {for (INT I = 1; I <CB. items. count; I ++) {console. writeline (CB. getitemchecked (0); CB. setitemchecked (I, CB. getitemchecked (0) ;}} else {If (! CB. getitemchecked (CB. selectedindex) {// when one of the other options is not selected, deselect "select all" CB. setitemchecked (0, false);} else if (! CB. getitemchecked (0) & CB. selecteditems. count> = (CB. items. count-1) {// when all others are selected, select "select all" CB. setitemchecked (0, true );}}}


I can't see any problems in the code.

After writing the log, it is concluded that when you click "select all" quickly, this event is not entered every time.

The problem that best thinking cannot ride elder sister-is it a control bug?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.