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.
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.