Valhalla Legends Archive

Programming => General Programming => .NET Platform => Topic started by: mentalCo. on October 21, 2004, 09:19 AM

Title: [VB.Net] ListView Columns
Post by: mentalCo. on October 21, 2004, 09:19 AM
Ok say you have a listview, "lvwChannel", with two columns, "colUsername" and "colPing".  How do you insert an item into the second column ("colPing")?
Title: Re: [VB.Net] ListView Columns
Post by: MyndFyre on October 21, 2004, 09:49 AM
Use the ListViewItem.SubItems collection:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformslistviewitemclasssubitemstopic.asp
Title: Re: [VB.Net] ListView Columns
Post by: Imperceptus on October 22, 2004, 02:46 PM
So yeah uhm what you need to know is that the column is a subitem, and you want to change the subitems text value
example "probally dont compile"

listview.listitems.listsubitems.text

or soemthing along those lines, you really need to search the forums.... I learned how to use the listview from these forums using just the search tool.
Title: Re: [VB.Net] ListView Columns
Post by: MyndFyre on October 23, 2004, 03:49 AM
You access it like a collection:


MyListView.ListItems(ItemIndex).SubItems(ColumnIndex).Text = "Value"

Title: Re: [VB.Net] ListView Columns
Post by: Imperceptus on October 23, 2004, 01:22 PM
was trying to not give the exact answer but point to what they would need to head in the right direction.  But yeah, thats it.   Good to know that you cannot refer to the column index as 0.   returns error.  If you want to return the text for the first column its

MyColumnOneValue = MyListView.ListItems(ItemIndex).Text