get ListView current cell

T

TBass

Hi,

I'm having no trouble populating a list view object, or getting a
signal that the user has selected a new cell. However, I can't find
any documentation on actually getting the index of the cell (and hence
the data string) that the user has selected.


my ListView is called listTags

I added the event with the following code:

void SelectionChangedListBox(Object *Sender, EventArgs *Args);
listTags->add_SelectedIndexChanged( new EventHandler(this,
SelectionChangedListBox ));


SelectionChangedListBox is getting called when the user selects a new
item. I just can't get the text or index of that item. Can anyone
point me in the right direction?

Thanks in advance,
T
 
T

TBass

Figured it out.

For anyone looking, here's a not-so-elegant-but-works solution:

int x;
ListViewItem *item;

for ( x=0;x<listTags->Items->Count;x++ )
{
item = listTags->Items->get_Item(x);
if ( item->Selected == true )
{
lblCurrentTag->Text = item->Text;
break;
}
}


Peace,
T
 

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