如何检查列表视图的复选框 [英] how to checked checkboxes of listview

查看:86
本文介绍了如何检查列表视图的复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好...

我在listview中具有带复选框的listitems,并设置了checkbox = true设置属性复选框,当我运行该listview时,该时间显示了所有带checked的listitems,但现在我未选中某些listitems.当我取消选中某些选项时,我想显示该选中状态.在这种情况下,我们必须努力.

当再次运行该列表视图时,该时间还会显示未选中的项目..
怎么可能..
请让我知道..

hhi to all...

i have listitems in listview with checkboxes and set property checkboxes checked =true and when i run that listview that time shows all listitems with checked but now i unchecked some listitems. when i unchecked some lstitems i want to strore that check staus..how ? in which event we have to strore..

when again run that listview that time shows unchecked items also..
how is it possible ..
pls let me know..

推荐答案

使用ListView控件的listView1_ItemCheck()事件并编写以下代码. 现在,您可以轻松找到未选中的复选框.

Use the listView1_ItemCheck() event of the ListView control and write the following code.
Now you can find easily which checkbox is checked which is not.

private void listView1_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            ListViewItem l = listView1.Items[e.Index];
            if (e.NewValue == CheckState.Checked)
            {
                MessageBox.Show(l.ToString() + "  is checked.");

            }
            else
            {
                MessageBox.Show(l.ToString() + "  is UNchecked.");
            }
        }


这篇关于如何检查列表视图的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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