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
LVL 8
bukkoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
TimCotteeHead of Software ServicesCommented:
Have a look here:

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

It explains how to detect subitem clicks in full.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.