[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 779
  • Last Modified:

Listview ListSubItems

Hi,

How can I dynamically add listsubitems to a listitem in a listview with events?
I want to be able to detect a right or left click of a particular column of a report style listview.

Thanks

bukko
0
bukko
Asked:
bukko
2 Solutions
 
Ryan ChongCommented:
You need to add the listviews' ColumnHeader instead..
0
 
bukkoAuthor Commented:
I did that.
I can get click events for the columnheaders with no problems.

I want a click event for the subitems.
In other words, I want to be able to click (or event better doubleclick) a row, and be able to determine which column was clicked, not just the row.
0
 
JR2003Commented:
You can use th emousedown event to get the current Listitem the mouse is over using the listview's 'HitTest' method.

If there is no horizontal scrolling on the listview then you can get the column the mouse is over by using the 'y' value in the mousedown event and checking this against the column header widths to calculate which column is being clicked.

The listView isn't designed to have individual cells clicked you may be better off using the FlexGrid control if you want to do that.

JR
0
 
TimCotteeCommented:
Have a look here:

http://vbnet.mvps.org/code/comctl/lvhittest.htm

It explains how to detect subitem clicks in full.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now