fabulous Level: VB Guru

 Registered: 03-08-2002 Posts: 439
|
Re: regarding listviews
Look at this code as an example:
Dim str As String
If lvwExample.SelectedItems.Count = 0 Then
MessageBox.Show("Go away")
Else
For Each lvwItem As ListViewItem In lvwExample.SelectedItems
For i As Integer = 0 To lvwItem.SubItems.Count - 1
str &= lvwItem.SubItems(i).Text & " "
Next
str &= ControlChars.CrLf
Next
End If
MessageBox.Show(str) |
I am looping through all the selected items building a string that is displayed at the end of the routine.
Depending on what you want to do, you can make the target form have a constructor that accepts a string and pass it a string that represents the selected item.
An alternative is also passing the entire selected item. the constructor would be designed to accept a ListViewItem like this:
Public Sub New(Byval lItem As ListViewItem)
'code here
'.....
End Sub |
Hope that helps. Happy coding.
____________________________
My boss is a Jewish Carpenter (Jesus Christ)

Brain Bench Certified VB.NET Developer
|