title: How Can I Get the Index of An Item in a ListBox?
body: <p>I am adding items to a <code>ListBox</code> like so:</p>
  
  <pre><code>myListBox.Items.addRange(myObjectArray);
  </code></pre>
  
  <p>and I also want to select some of the items I add by the following:</p>
  
  <pre><code>foreach(MyObject m in otherListOfMyObjects) 
  {
      int index = myListBox.Items.IndexOf(m);
      myListBox.SelectedIndices.Add(index);
  }
  </code></pre>
  
  <p>however <code>index</code> is always <code>-1</code>.</p>
  
  <p>Is there a different way to get the index of an object in a <code>ListBox</code>?</p>