Reputation: 29
Can you guys help me code if I select one of the checkboxes on the ListView section, the rest of the checkboxes should be checked.
My ListView name is lvBase and I want to used the ListView ItemCheck events.
This is my code.
private void lvBase_ItemCheck_1(object sender, ItemCheckEventArgs e)
{
}
Upvotes: 0
Views: 270
Reputation: 18155
Hope I understood your question correctly, If you want to check all the checkbox in the list, you can loop through them and set Checked Property to true.
private void lvBase_ItemChecked(object sender, ItemCheckedEventArgs e)
{
for (int i = 0; i < lvBase.Items.Count; i++)
{
lvBase.Items[i].Checked = e.Item.Checked;
}
}
Upvotes: 1
Reputation: 146
Use the following line to add an itemcheck or itemchecked event:
this.listView1.ItemCheck += new ItemCheckEventHandler(listView1_ItemCheck);
Upvotes: 1