
Originally Posted by
Krool
The fix as you suggested is OK. However, I would like to replicate the problem to look for another potential issue.
But I couldn't replicate. Can you bundle a small demo?
I used your demo in post #1. I added 2 new test buttons with code below. Note. Setting .Redraw=False also prevents the error.
Code:
' button to remove listitems & column headers
Dim n&
ListView1.ListItems.Clear
For n = ListView1.ColumnHeaders.Count To 2 Step -1
ListView1.ColumnHeaders.Remove n
Next
' button to re-add columns & errors
ListView1.ColumnHeaders.Add , , "NewCol"
ListView1.ColumnHeaders.Add , , "NewCol2"
The MS ListView behaves exactly the same. So I do not consider this being a "bug". Thanks however for your testing.
Wow, never really noticed. I was assuming it would react similar to deleting a column from an Excel sheet. But v6 of the Listview doesn't shift column contents when headers are removed. I should've been using the .ListSubItems.Remove method of each listview item to produce the results I expected. With old age no longer creeping up, it has settled in, wonder if this is something I re-learned?