Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[COLOR=green]'Assume there is a ListView with default name[/color]
[COLOR=blue]Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load[/color]
[COLOR=green]'Add headings / items to listview, view property set to Details[/color]
ListView1.Columns.Add("C1", 200, HorizontalAlignment.Center)
ListView1.Columns.Add("C2", 200, HorizontalAlignment.Center)
ListView1.Items.Add("Item 1")
ListView1.Items(0).SubItems.Add("Subitem 1")
ListView1.Items.Add("Item 2")
[COLOR=blue]End Sub[/color]
[COLOR=blue]Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged[/color]
Dim i1 As String
Dim i2 As String
[COLOR=green]'get item and subitem values[/color]
i1 = ListView1.SelectedItems(0).SubItems(0).Text
i2 = ListView1.SelectedItems(0).SubItems(1).Text
[COLOR=green]'show the values[/color]
MessageBox.Show("1: " & i1 & " - 2:" & i2)
[COLOR=blue]End Sub[/color]
Dim itmX as ListViewItem
For Each itmX in ListView1.SelectedItems
[COLOR=green]'process each item[/color]
Next
Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
Dim i1 As String
Dim i2 As String
'get item and subitem values
If ListView1.SelectedItems.Count > 0 Then
i1 = ListView1.SelectedItems(0).SubItems(0).Text
i2 = ListView1.SelectedItems(0).SubItems(1).Text
'show the values
MessageBox.Show("1: " & i1 & " - 2:" & i2)
End If
End Sub