G
Guest
I've seen this technique for grabbing the listviewitem from a right-click:
private void listView1_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
{
if(e.Button == MouseButtons.Right)
{
ListViewItem rClickedItem = listView1.GetItemAt(e.X, e.Y);
}
}
and this works fine if I right-click anywhere on the 1st column on any row.
But if I click on the data in any of the other columns I get a null
listviewitem, ie on the subitems. What am I doing wrong?
private void listView1_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
{
if(e.Button == MouseButtons.Right)
{
ListViewItem rClickedItem = listView1.GetItemAt(e.X, e.Y);
}
}
and this works fine if I right-click anywhere on the 1st column on any row.
But if I click on the data in any of the other columns I get a null
listviewitem, ie on the subitems. What am I doing wrong?