Has anyone come across a problem using the ActiveX Listview control (as supplied with VB6) in VB.NET?
I put this listview on a form and execute the following code:
Private Sub Button1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
Dim i As Integer
Dim itmItem As MSComctlLib.ListItem
Dim s As String
For i = 1 To 3
AxListView1.ListItems.Add(CStr(i))
Next
For Each itmItem In AxListView1.ListItems
MsgBox(itmItem.text)
Next
End Sub
The "for each" loop should be executed 3 times, but I find
that it executes 4 times, giving an error on the 4th time
through as itmItem is Nothing.
Is this a known problem?
I put this listview on a form and execute the following code:
Private Sub Button1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
Dim i As Integer
Dim itmItem As MSComctlLib.ListItem
Dim s As String
For i = 1 To 3
AxListView1.ListItems.Add(CStr(i))
Next
For Each itmItem In AxListView1.ListItems
MsgBox(itmItem.text)
Next
End Sub
The "for each" loop should be executed 3 times, but I find
that it executes 4 times, giving an error on the 4th time
through as itmItem is Nothing.
Is this a known problem?