Bug in ListBox.IndexFromPoint ?

  • Thread starter Michael A. Covington
  • Start date
M

Michael A. Covington

When capturing a MouseDown event on a ListBox, I want to find out which list
item the mouse is on. So I do this:

int i = listBox1.IndexFromPoint(e.X,e.Y);

A click on a nonexistent item (e.g., a listbox from which everything has
been deleted) gives i=65535 but ListBox.NoMatches = -1.

If I say this:

int i = (int16) listBox1.IndexFromPoint(e.X,e.Y);

then I get -1 for nonexistent items as I should. This is in VS 2005.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top