Traverse a Listview-- **Resolved **
I am trying to loop through a listview in order to process the items placed there by user interaction.. I have this:
Dim A As Windows.Forms.ListViewItem
For Each A In ListView2.Items
MsgBox(A.Text, vbOKOnly , "Warning")
Next
and get the following error:
An unhandled exception of type 'System.InvalidCastException' occurred in Outlook_Net.exe
Additional information: Specified cast is not valid.
ListView2 contains 4 items which got there using this process:
With ListView2
.BeginUpdate()
.Items.Add(Me.ListView1.SelectedItem.ToString())
.EndUpdate()
End With
It was so easy with VB6...