Results 1 to 1 of 1

Thread: Traverse a Listview-- **Resolved **

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Hendersonville , NC
    Posts
    260

    Question 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...
    Last edited by gollnick; Mar 28th, 2003 at 09:41 AM.
    William E Gollnick

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width