获取的ListView ItemCheck停止! [英] Getting the ListView ItemCheck to stop!

查看:260
本文介绍了获取的ListView ItemCheck停止!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着一些SO的意见,我曾尝试在ItemCheck事件ListView控件的以下内容:

Following some SO advice I have tried the following on the ItemCheck event of a ListView control:

private void lstTasks_ItemCheck(object sender, ItemCheckEventArgs e)
    {
     ...some code

     return;
     }

这个想法是,该的回报; 将取消该事件

...但空白的返回之前不运行某些code;?否定了预期的效果。

...but does running some code before the blank return; negate the desired result?

我要使用 ItemCheck 事件,因为它可以让我从ListView控件通过e.Index提取数据,并运行一些更新。当我返回到ListView在 ItemCheck 尚未完成发射,并会经常出现死机的程序,因为它无法找到所需的索引号,由于更新,删除该项目。

I want to use the ItemCheck event because it allows me to pull data via e.Index from the ListView and run some updates. When I return to the ListView the ItemCheck hasn't finished firing and will often crash the program because it can't find the desired index number due to the updates removing that item.

推荐答案

返回; 不会取消该事件

相反,你可以设置 e.NewValue CheckState.Checked 的CheckState。未检查

Instead, you can set e.NewValue to CheckState.Checked or CheckState.Unchecked.

这篇关于获取的ListView ItemCheck停止!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆