Hi,

How would I loop through a list view control to add multiple items?

This is the code I use for a single items but I can't get it working in a loop.

vb Code:
  1. 'Retrieve mail from inbox
  2.     Dim iMsgID As Integer
  3.     Dim COLH As Integer
  4.     'Dim mSubitem As ListItems
  5.     For COLH = 0 To 2
  6.     If frmMain.LstNewMail.ListItems.Count = 0 Then
  7.     'For Each mSubitem In frmMain.LstNewMail.ListItems
  8.      Set itmM = frmMain.LstNewMail.ListItems.Add(, , Pop3.Messages(iMsgID).From)
  9.       COLH = COLH + 1
  10.       itmM.SubItems(COLH) = Pop3.Messages(iMsgID).Subject
  11.        COLH = COLH + 1
  12.        itmM.SubItems(COLH) = Pop3.Messages(iMsgID).Date
  13.      '   Next mSubitem
  14.     End If
  15.     Next COLH

The code I have commented out was my attempt to insert items using a loop.

Thanks,


Nightwalker