ListView Question

  • Thread starter Thread starter Zach
  • Start date Start date
Z

Zach

Re a ListView

I would like to establish what is in the first
column of a row of which I know the index (k).
(Given that the list view is filled with data.)

I have tried e.g.:

MessageBox.Show(listView1.Items[k],SubItems[1].ToString())

but this doesn't work.

What is the correct *code*?

Many thanks.
 
SubItem indexes are '0' based. Also, they have a property called "Text"
that you might use

Try:

MessageBox.Show(listView1.Items[k].SubItems[0].Text);

-vJ
 
Vijaye Raji said:
SubItem indexes are '0' based. Also, they have a property called "Text"
that you might use

Try:

MessageBox.Show(listView1.Items[k].SubItems[0].Text);

-vJ

It worked.
Many thanks.
 

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

Back
Top