Winform CheckedListBox implements full/All deselected, winformlistbox

Source: Internet
Author: User

Winform CheckedListBox implements full/All deselected, winformlistbox

/Select all private void button3_Click (object sender, EventArgs e) {for (int I = 0; I <this. checkedListBox1.Items. count; I ++) {this. checkedListBox1.SetItemChecked (I, true) ;}// select private void button4_Click (object sender, EventArgs e) {for (int I = 0; I <checkedListBox1.Items. count; I ++) {if (checkedListBox1.GetItemChecked (I) {checkedListBox1.SetItemChecked (I, false);} else {checkedListBox1.SetItemChecked (I, true );}}}

  


The checkedlistbox has been bound. How to add the first line and the content to a checkbox can be all selected or not all selected

Put all the same, this is the full selection and reverse selection of the checkbox in the irdview.
Private void checkAll_CheckedChanged (object sender, EventArgs e)
{
If (checkAll. Checked)
{
For (int I = 0; I <dgvLinkMan. Rows. Count; I ++)
{
This. dgvLinkMan [1, I]. Value = true;
}
}
Else
{
For (int I = 0; I <dgvLinkMan. Rows. Count; I ++)
{
This. dgvLinkMan [1, I]. Value = false;
}
}
}

Check whether all or not to select a checkbox

The figure is not clear, but the general principle is as follows:

<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> untitled document </title>
<Script language = "javascript">
Function selected ()
{
Var allsel = document. getElementsByName ("car ");
For (var I = 0; I <allsel. length; I ++)
{
Allsel [I]. checked =! Allsel [I]. checked;
}
}
</Script>
</Head>

<Body>
<H1> select all/do not select all Select All/cancel <br/>
<Input type = "checkbox" id = "sel" name = "sel" value = "yes" onclick = "selected ()">
<Br/>
<Input type = "checkbox" id = "car" name = "car" value = "two"> aa <br/>
<Input type = "checkbox" id = "car" name = "car" value = "three"> bb <br/>
<Input type = "checkbox" id = "car" name = "car" value = "four"> cc <br/>
</Body>
</Html>

Related Article

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.