[RESOLVED] [2005] Retrieving SubItems Value
I have a ListView with three columns. The first two are text and third is numeric.
I need to get the value from column three (subitem(2)). Here is what I've tried
Code:
Messagebox.Show(lvwAddresses.SelectedItems.Item(2)
But, I got this error message: "Value of type 'System.Windows.Forms.ListViewItem' cannot be converted to 'String'."
So, I tried
Code:
MessageBox.Show(lvwAddresses.SelectedItems.ToString(Item(2)))
Then I got this error message: "Name item is not declared."
So, how would I get that?
Re: [2005] Retrieving SubItems Value
lvwAddresses.SelectedItem.Tostring is enough
You just have to make sure that all three lists have the same item index selected.... if that is what you want??
lvwAddresses.SelectedItemIndex = otherlist.SelectedItemIndex etc...
Messagebox.Show(list1.selectedIem.Tostring + list2.selectedIem.Tostring + lvwAddresses.selectedIem.Tostring)
Re: [2005] Retrieving SubItems Value
Try
lvwAddresses.SelectedItems(2).Text
Re: [2005] Retrieving SubItems Value
Quote:
Originally Posted by JXDOS
You just have to make sure that all three lists have the same item index selected
I don't know what you mean by this. I have one ListView with three columns, not three lists.
1 Attachment(s)
Re: [2005] Retrieving SubItems Value
Quote:
Originally Posted by JXDOS
lvwAddresses.SelectedItem.Tostring is enough
This resulted in this
Re: [2005] Retrieving SubItems Value
1 Attachment(s)
Re: [2005] Retrieving SubItems Value
Quote:
Originally Posted by zalez
Try
lvwAddresses.SelectedItems(2).Text
This resulted in this
Re: [2005] Retrieving SubItems Value
Code:
For Each item As ListViewItem In lvwAddresses.SelectedItems
For Each subItem As ListViewItem.ListViewSubItem In item.SubItems
Console.Out.WriteLine(subItem.Text)
Next
Next
Re: [2005] Retrieving SubItems Value
lvwAddresses.SelectedItems.Item(0).SubItems(2).Text
Re: [2005] Retrieving SubItems Value
Quote:
Originally Posted by zalez
lvwAddresses.SelectedItems.Item(0).SubItems(2).Text
That is what I needed.
Thanks!
Re: [RESOLVED] [2005] Retrieving SubItems Value