[RESOLVED] [2005] repopulating tablelayoutpanel
I have a TLP that constantly refreshes by use of a timer. I initialize the table with blank labels when the form is rendered and then each time the timer is fired it copys data from a listbox and I change the label text of each control in a loop. The problem is that when it changes from one screen to the next (one timer iteration to the next) - it moves slowly - in other words, when the characters change in the cell it is not a smooth transition.
Below is my timer code and the init tlp code
Code:
Public Sub initTable()
Dim x As Int16
For x = 0 To 19
Dim label1 As New Label
With label1
.Text = ""
' .TextAlign = ContentAlignment.MiddleCenter
.Font = My.Settings.myFont
.ForeColor = My.Settings.myForeColor
.BackColor = My.Settings.myBackColor
.AutoSize = True
End With
Me.TableLayoutPanel1.Controls.Add(label1)
Next
End Sub
Public Sub TimerFired(ByVal sender As Object, _
ByVal e As System.EventArgs)
pkgCnt = frm1.lstApts.CheckedItems.Count
Dim d As Decimal = (pkgCnt / 20)
numPages = Decimal.Truncate(d)
If pkgCnt Mod 20 = 0 And pkgCnt > 0 Then
numPages = numPages - 1
End If
Dim row As Integer = 0
Dim col As Integer = 0
Dim curlabel As Label
Dim sourceIndex As Integer = 0
Dim sourceArray(pkgCnt - 1) As Object
frm1.lstApts.CheckedItems.CopyTo(sourceArray, 0)
' Me.TableLayoutPanel1.Controls.Clear()
sourceIndex = (curPage * 20)
For row = 0 To 3
For col = 0 To 4
curLabel = New Label
curLabel = Me.TableLayoutPanel1.GetControlFromPosition(col, row)
With curLabel
If sourceIndex >= sourceArray.Length Then
.Text = " "
Else
Text = sourceArray(sourceIndex)
' .TextAlign = ContentAlignment.MiddleCenter
.Font = My.Settings.myFont
.ForeColor = My.Settings.myForeColor
.BackColor = My.Settings.myBackColor
End If
End With
sourceIndex = sourceIndex + 1
Next
Next
If curPage >= numPages Then
curPage = 0
Else
curPage = curPage + 1
End If
sourceIndex = 0
End Sub
Any suggestions?
Re: [2005] repopulating tablelayoutpanel
I resolved by making tlp invisible while repopulating then making visible again