G
Guest
I'm filling a listbox with a zillion rows from a database. I'm executing a
background thread to add to the underlying DataTable so the user does not
have to wait.
The problem is this - the Listbox still seems to flicker as it is filled.
Is there a way to stop this?
Private Sub continuefilling(ByVal Thing As Object)
Do
Me.ListBox1.SuspendLayout()
Dim SQL As String = "Select top 10 ID, Account From Accounts
where ID > " + LastAccountID.ToString + " order by account"
Dim DT2 As DataTable = DB.GetDataSet(SQL).Tables(0)
If DT2.Rows.Count = 0 Then Return
LastAccountID = CInt(DT2.Rows(DT2.Rows.Count - 1)("ID"))
For Each r As DataRow In DT2.Rows
DT.ImportRow(r)
Next
Me.ListBox1.ResumeLayout()
Loop
End Sub
background thread to add to the underlying DataTable so the user does not
have to wait.
The problem is this - the Listbox still seems to flicker as it is filled.
Is there a way to stop this?
Private Sub continuefilling(ByVal Thing As Object)
Do
Me.ListBox1.SuspendLayout()
Dim SQL As String = "Select top 10 ID, Account From Accounts
where ID > " + LastAccountID.ToString + " order by account"
Dim DT2 As DataTable = DB.GetDataSet(SQL).Tables(0)
If DT2.Rows.Count = 0 Then Return
LastAccountID = CInt(DT2.Rows(DT2.Rows.Count - 1)("ID"))
For Each r As DataRow In DT2.Rows
DT.ImportRow(r)
Next
Me.ListBox1.ResumeLayout()
Loop
End Sub