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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retreive Row index from a listview

Status
Not open for further replies.

jbsys

Programmer
May 6, 2005
51
CA
Hi;
Being relativly new to C# and .NET, I am hoping someone can point me in the right direction. I have a listview called mylistview such as:
|--------------------------------------|
|City | Los Angeles | 3,600,000 |
|--------------------------------------|
|City | New York | 5,600,000 |
|--------------------------------------|
|Town | Cheektowaga | 600,000 |
|--------------------------------------|
|City | Miami | 4,500,000 |
|--------------------------------------|

When I click on the listview item in the 2nd row, 2nd column (New York), I need to be able to find out what the value of the 2nd row, 1st column cell is: (City).


Thanks
jbsys
 
something to the effect of:

ListViewItem myitem = mylistview.SelectedItem;

MessageBox.Show(myitem.SubItems[1].ToString());

either 0 or 1 for subitem in this case. I'm doing this from memory.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top