event handling for list view question

A

a

Hi,

I have a 3-column listview. It has to return the value of the cell when the
user click the listview.
The SelectedIndexChanged event and ItemSelectionChanged Event only return
the row information (ListViewItem).
If I want to return the cell value of the second and the third column, which
event should I use?

Let say, if the user select row 2, column 3, which event handling
procedure should be used to return the value of the cell (2,3)?
Or, it is also fine, if the event handling procedure is able to return the
co-ordinate of the selected cell.

Thanks
 
N

Nicholas Paldino [.NET/C# MVP]

You could keep track of the mouse location (from the mouse up event) and
then pass that to the HitTest method on the ListView class. It will return
to you the item and the sub item at that mouse position.
 
S

steve.falzon@

Hi,

I have a 3-column listview. It has to return the value of the cell when the
user click the listview.
The SelectedIndexChanged event and ItemSelectionChanged Event only return
the row information (ListViewItem).
If I want to return the cell value of the second and the third column, which
event should I use?

Let say, if the user select row 2, column 3, which event handling
procedure should be used to return the value of the cell (2,3)?
Or, it is also fine, if the event handling procedure is able to return the
co-ordinate of the selected cell.

Thanks

Hi

An excellent example of what you need is the GlacialList component
available here

http://www.codeproject.com/cs/miscctrl/aa_listview.asp

there is commercial version available but the one on code project is
free. It's pretty cool and has full source and demos. It's very well
written, is easy to follow and make changes to.

I downloaded it a year or so ago so it may well have been updated.
Either way it is an excellent piece of work. I used it as a basis for
my own stuff and have only encountered minor problems which have been
easily resolved, mostly I've just added particular features I
required.

HTH

Cheers
Steve
 
B

Ben Voigt [C++ MVP]

a said:
Hi,

I have a 3-column listview. It has to return the value of the cell when
the
user click the listview.

You might like DataGridView better.
 

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