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>