private void button1_Click(object sender, System.EventArgs e)
{
if (this.checkedListBox1.CheckedItems.Count > 0)
{
this.listBox1.Items.Clear() ;
foreach (string items in this.checkedListBox1.CheckedItems)
{
this.listBox1.Items.Add(items.ToString ()) ;
}
}
for (int i = 0 ; i < this.checkedListBox1.CheckedItems.Count ; i++)
{
this.checkedListBox1.SetItemChecked ( i , false) ;
}
}
和下面的为什么不一样.
private void button1_Click(object sender, System.EventArgs e)
{
if (this.checkedListBox1.CheckedItems.Count > 0)
{
this.listBox1.Items.Clear() ;
foreach (string items in this.checkedListBox1.CheckedItems)
{
this.listBox1.Items.Add(items.ToString ()) ;
}
for (int i = 0 ; i < this.checkedListBox1.CheckedItems.Count ; i++)
{
this.checkedListBox1.SetItemChecked ( i , false) ;
}
}
}