With Deft Fingers, billyb <bi****@discuss ions.microsoft. com> wrote:
My listview has two columns: Email Address & Email Address Type.
I've figured out how to populate it, but now I'm having trouble figuring out how to properly use the SelectedItems to get at the particular row that is double clicked. Can someone give me an example of how to get at the item, and subitems, of a selected row in a listview?
My Code here is used in a "SelectedIndexC hanged" routine... but you should be
able to modify things for your need. My ListView is called "lvModDwgs" . I
had to remove excess 'junk' from my strings (see the INFO lines).
I had my LV "multiselec t" to TRUE... so I can click on more than 1 line. And
the 'first' item per each selected line ends up being 'TmpStrng1' that I list
in a ComboBox (just for info only).
Dim TmpStrng, TmpStrng1 As String
Dim LItem As ListViewItem
Dim LItems As ListView.Select edListViewItemC ollection
LItems = lvModDwgs.Selec tedItems
' INFO - LItem.SubItems( 2).ToString = "ListViewSubIte m: {60-004}"
' Remove ListViewSubItem Gargage!
ComboBox1.Items .Clear()
For Each LItem In LItems
' Remove the Excess Junk from String
TmpStrng = LItem.SubItems( 1).ToString
TmpStrng = Microsoft.Visua lBasic.Right(Tm pStrng, Len(TmpStrng) - 18)
TmpStrng = Microsoft.Visua lBasic.Left(Tmp Strng, Len(TmpStrng) - 1)
txbDwgTab.Text = TmpStrng
' Add Selected Names to ComboBox - Use this to Identify your Selections
TmpStrng1 = LItem.SubItems( 0).ToString
TmpStrng1 = Microsoft.Visua lBasic.Right(Tm pStrng1, Len(TmpStrng1) - 18)
TmpStrng1 = Microsoft.Visua lBasic.Left(Tmp Strng1, Len(TmpStrng1) - 1)
ComboBox1.Items .Add(TmpStrng1)
Next
Regards,
Bruce