Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Listview in C++ .NET

Status
Not open for further replies.

ReMiNiScE

Programmer
Feb 15, 2005
1
US
I
was wondering how I can use a listview effectively in managed c++
.net. Basically I'm trying to get the index of the selected item in
the list view, then get the "tag" attribute of that item to invoke
data in other area of my app.

Here's some example code:
//////////////////////////////////////

private: System::Void lstTeams_SelectedIndexChanged(System::Object *
sender, System::EventArgs * e)
{
int index = lstTeams->SelectedIndices->get_Item(0);

}
//////////////////////////////////////


That's basically just assigning the index of my selected item to int
"index". Is this correct? When I go to my form and change to a
different item in my listview box, I get a "Specified argument was out
of range of valid values". Also, it APPEARS that when I change to a
different item in my listview, lstTeams_SelectedIndexChanged fires
TWICE. Any idea why?

I've been working of this project lately, and these .NET GUI controls
are really binding me.

I would appreciate it if you could give me some pointers.

Thanks much for your time,
kyle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top