Jump to content

Selecting Row from Listview

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
Darkco

Darkco

    Newbie

  • Members
  • PipPip
  • 13 posts
Hey,

So I want to select a row from the listview1 and write a popup and this is the method which worked for me but are there any other ways to do this they might help me in the future :)


for (int x = 0; x < listview1.Items.Count; x++)

if (listview1.Items[x].Selected)

MessageBox.Show(listview1.Items[x].SubItems[1].Text);


Also I dont really understand the function of the line .SubItems[1] why is this necessary

#2
semprance

semprance

    Programmer

  • Members
  • PipPipPipPip
  • 126 posts
If you right-click your listview box and then select Edit Items, then select the [...] button from the 'SubItems', you can add items in sub-collections of other items.

It's basically a way of nesting items within items for listviews.