vb7guy
asked on
Read ListView Items by Column Name
Hi, We use listView in our vb.net project (VB 2005). up until now we've been Referencing the item and sub item by index. We'd like to change that and Reference item by it's column name.
for example:
it we have four columns in our list. i
Column1, Column2,Column3,Column4
current Code
For i As Integer = 0 To listView1.Items.Count - 1
Console.WriteLine(listView 1.Items(i) .SubItems( 1).Text)
Next
We'd like to use listView1.Items(i).SubItem s("Column1 ").Text
I can't figure out how to do this currently, because it's not working right now.
for example:
it we have four columns in our list. i
Column1, Column2,Column3,Column4
current Code
For i As Integer = 0 To listView1.Items.Count - 1
Console.WriteLine(listView
Next
We'd like to use listView1.Items(i).SubItem
I can't figure out how to do this currently, because it's not working right now.
I believe this post should answer your question: http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/b96f9fbe-e128-4b49-833d-2a5f6e678dae
ASKER
Thanks for the response. but this post doesn't work with VB.net
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Here, I figured it out on my own. too bad, this isn't well documented in books online.
Console.WriteLine(listView 1.Items(i) .SubItems( listView1. Columns.In dexOfKey(" column1")) .Text)
Console.WriteLine(listView
ASKER
Since your response was kind of partial. I'll accept it as the solution.