How to get ListView Control subitem by columnHeader Name?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

i put a listview control in win form and add some columnHeaders, give the
comumnHeader's name, Can i get ListView Control subitem by columnHeader Name ?

Thanks
 
Can't you just create several constants from 0 to 7 as hard coded
references?

const COLUMN1_FIRST NAME as int32 = 1

listview1.selecteditem(0).subitem(COLUMN1_FIRST NAME).text
 
Hi Pony,

Thank you for posting.

You can not use a column header name to get the subitem in a listview. But
you can get the subitem's index by the known column header(eg.
columnHeader1) by the sentence: columnHeader1.Index

So if you want to get the subitem of a known column header(eg.
columnHeader1), you may use the following sentence:
ListViewSubItem item = listView1.Items[0].SubItems[columnHeader1.Index]

Hope this is helpful to you.
If you have any concerns or need anything else, please don't hesitate to
let me know.



Sincerely,
Linda Liu
Microsoft Online Community Support

====================================================
When responding to posts,please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
====================================================
 
Back
Top