Obtain the index of a just clicked checkBox

M

Marcelo

Greetings!
I develop a multiple forms application in Microsoft Visual
Studio C++ .NET 2003. I am working with a listView with checkBoxes and
an event relative to the clicking of a checkBox in this list
(listView1_ItemCheck). When the event starts, I need to know which was
the check checkBox (its index) that shot the event. But I do not get to
do that.. I've already tryed:


- Use the "listView::CheckedItems" property, but it appears that the
item is checked just when the event is finished...so the box I checked
is not counted in "CheckedItems" property

- Use a dynamic_cast...
ListViewItem* checkedItem = dynamic_cast<ListViewItem*>(se­nder);
int index=checkedItem->get_Index()­;

None work... any idea of how to get the index of the checked item is
welcome.
Marcelo Roggia Schio
 
J

James Park

I think the Index property of the ItemCheckEventArgs argument is what you
need.

Greetings!
I develop a multiple forms application in Microsoft Visual
Studio C++ .NET 2003. I am working with a listView with checkBoxes and
an event relative to the clicking of a checkBox in this list
(listView1_ItemCheck). When the event starts, I need to know which was
the check checkBox (its index) that shot the event. But I do not get to
do that.. I've already tryed:


- Use the "listView::CheckedItems" property, but it appears that the
item is checked just when the event is finished...so the box I checked
is not counted in "CheckedItems" property

- Use a dynamic_cast...
ListViewItem* checkedItem = dynamic_cast<ListViewItem*>(se­nder);
int index=checkedItem->get_Index()­;

None work... any idea of how to get the index of the checked item is
welcome.
Marcelo Roggia Schio
 
M

Marcelo

That's right. I thank you very much.
I hadn't realyzed this property...
Marcelo Roggia Schio
 

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