title: Handling double click events on ListBox items in C#
body: <p>I am trying to do something when double clicking an item in a ListBox. I have found this code for doing that </p>
  
  <pre><code>void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
      {
          int index = this.listBox1.IndexFromPoint(e.Location);
          if (index != System.Windows.Forms.ListBox.NoMatches)
          {
              MessageBox.Show(index.ToString());
              //do your stuff here
          }
      }
  </code></pre>
  
  <p>However, when i click on an item, the event isn't fired. The event is fired if i click in the ListBox below all the items. </p>
  
  <p>I set the DataSource property of the <code>ListBox</code> to <code>IList&lt;MyObject&gt;</code>.</p>
  
  <p>Any ideas?</p>