title: Select index from listview
body: <p>I'm having some problem to get the index of the selected row in a listview. I wonder why this code isn't working? I get a red line below the SelectedIndex</p>
  
  <pre><code>    private void lvRegAnimals_SelectedIndexChanged(object sender, EventArgs e)
      {
          int index = lvRegAnimals.SelectedIndex;
          string specialData = motelManager.GetInfoFromList(index);
          UppdateSpecialData(specialData);
      }
  </code></pre>
  
  <p>Help is preciated. Thanks!</p>
  
  <p>EDIT:</p>
  
  <p>For some strange reason I get two messages when I click on one of the lines in the listView!? First I get the previous number and then the number for the last clicked line. What could be wrong?</p>
  
  <pre><code> private void lvRegAnimals_SelectedIndexChanged(object sender, EventArgs e)
      {
          int index = lvRegAnimals.FocusedItem.Index;
          MessageBox.Show(Convert.ToString(index));
      }
  </code></pre>
  
  <p>It's working now when I added a check like this:</p>
  
  <pre><code>if(lvRegAnimals.SelectedIndices.Count &gt; 0)
  </code></pre>