How to stop a listview from being painted.
In my application I have a method that iterates over rows in a table to add them to a listview. When the listview is visible, the first few entries that go down till the edge of the application's window are really slow. As soon as it starts processing the entries that are out of view, it's fast.
In my loop, which looks like this:
VB Code:
For Each row In rows
Dim lvi As GlacialComponents.Controls.GLItem
lvi = glist.Items.Add(CType(row(1), String))
lvi.SubItems(1).Text = (CType(row(2), String))
lvi.SubItems(1).ForeColor = Color.Maroon
lvi.SubItems(2).Text = (CType(row(3), String))
lvi.SubItems(2).ForeColor = Color.DarkBlue
lvi.SubItems(3).Text = (CType(row(5), String))
lvi.SubItems(4).Text = (CType(row(6), String))
lvi.SubItems(4).ForeColor = Color.Green
lvi.SubItems(4).Font = verdanab
lvi.SubItems(5).Text = (CType(row(7), String))
lvi.SubItems(5).ForeColor = Color.DarkBlue
lvi.SubItems(5).Font = verdanab
lvi.SubItems(6).Text = (CType(row(4), String))
lvi.SubItems(7).Text = (CType(row(12), String))
progress.Value += 1
Next row
How can I stop the listview from painting on each row that way it processes quick? Then I can do glist.update() or is it glist.refresh() after the line with next row, is that right? Or am I missing something?
I should mention that turning off visibility also does the trick, but I want the listview to show an empty "dummy list" for aesthetics purposes.
This is essentially one of the last elements of my software before I go through and do some serious testing.