tehon3299
Centurion
Why am I getting an error that says I can only add "First Item" in one spot or I must remove or clone it?
Am I adding the ListViewItem to the lvw wrong? If I move the lvw.Items.Add(listViewItem) outside the loop it works fine but obviously only does it once. Once I move it into the loop, it bombs.
Visual Basic:
Dim listViewItem As New ListViewItem()
Dim ctr As Integer = 0
lvw.View = View.Details
lvw.Columns.Add("First Column", 100, HorizontalAlignment.Center)
lvw.Columns.Add("Second Column", 100, HorizontalAlignment.Center)
lvw.Columns.Add("Third Column", 100, HorizontalAlignment.Center)
For ctr = 0 To 5
listViewItem.Text = "First Item"
listViewItem.SubItems.Add("Second Item")
listViewItem.SubItems.Add("Third Item")
lvw.Items.Add(listViewItem)
Next
End Sub
Am I adding the ListViewItem to the lvw wrong? If I move the lvw.Items.Add(listViewItem) outside the loop it works fine but obviously only does it once. Once I move it into the loop, it bombs.