title: Checked items in C# Listview
body: <p>I have a Listview control in C# application filled with some names and checkboxes to select one or more value. Apart from clicking on checkboxes, user can also click on the name and it will become blue. I want to keep this functionality as clicking on the name shows some more data and clicking on checkbox marks it for further processing</p>
  
  <p>I believed that clicking on checkbox changes Item.Checked property and clicking on name Changes Item.Selected but it seems to be no so simple.</p>
  
  <p>I have a code that counts checked items:</p>
  
  <pre><code>private void Listview1_ItemChecked(object sender, ItemCheckedEventArgs e) 
  {
      foreach(ListViewItem Item in ListView1.Items) 
      {
          if (Item != null) 
          {
              if (Item.Checked == true) N++;
          }
      }
      Textbox1.Text = N.ToString();
  }
  </code></pre>
  
  <p>When user clicks checkboxes there is proper number displayes but when he clicks name, the checked number changes to 1 even if there are still more checkboxes checked, which is obviously wrong. Also when the form and the control load, I get my N=1 even if there are no checkboxes checked.</p>
  
  <p>What am I doing wrong? </p>
  
  <p>Edit:
  Thanks for quick response and useful hints!</p>
  
  <p>And I've just discovered that my problem was my negligence  as I forgot to remove my old code! :) 
  At first I used multiple selection to pick up items, then I  switched to checkboxes but still was calling SelectionChanged event and modifying textbox content</p>