المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : CheckBox ListView Multiple Selection Problem c#



C# Programming
07-09-2011, 02:21 AM
I am trying to develop an application with list view having CheckBoxes and Multiple Selection property as TRUE.

Single Selection works perfectly. But when I try Multiple selection, check box of all the currently selected rows get changed on every selection (and sets to not of the check value of the new selection)

Am I missing any event that I need to handle???
Please help me guys!!!

Thanks in advance...

Although I haven't handle any event, I am still giving the code (I think it'll be irrelevant)

//////////////// listView Properties///////////////////////////////////


this.listView.CheckBoxes = true;
this.listView.FullRowSelect = true;
this.listView.HideSelection = false;
this.listView.UseCompatibleStateImageBehavior = false;
this.listView.View = System.Windows.Forms.View.Details;

////////////////////////////////////////////////////////////////////////////

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

listView.Columns.Add("One", 100, HorizontalAlignment.Left);
listView.Columns.Add("Two", 100, HorizontalAlignment.Left);
listView.Columns.Add("Three", 100, HorizontalAlignment.Left);
listView.Columns.Add("Four", 100, HorizontalAlignment.Left);

for(int i = 0; i < 50; i++)
{
ListViewItem item = new ListViewItem();
item.Checked = true;
item.SubItems.Add("Garbage1");
item.SubItems.Add("Garbage2");
item.SubItems.Add("Garbage3");
listView.Items.Add(item);
}
}
}