What is the difference between the ListView.ItemCheck and ListView.ItemChecked events in .NET?
The ItemCheck
event is triggered when the checked state of an item is about to change, allowing you to examine the old and new value, and to cancel the change if you wish (by assigning the NewValue property of the eventargs parameter). ItemChecked
is triggered after the check (or uncheck) is completed.
Code sample:
private void ListView_ItemCheck(object sender, ItemCheckEventArgs e)
{
// the checked state of an item is about to change
if (e.NewValue == CheckState.Checked)
{
// perform some check if this is allowed, and if not...
e.NewValue = e.CurrentValue;
}
}
private void ListView_ItemChecked(object sender, ItemCheckedEventArgs e)
{
// the checked state of an item has changed
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With