Morning all,
I'm head scratching here, I can't work out why my richtextbox displays text quickly the first time but if i clear it and refill its much slower...
Its basically pulling notes from a SQL table and displaying them in a rich text box, data is returned from SQL very quickly and it appears to be the text box thats is slow... Code is as follows:
The first time it runs the time stamps are:
notes update start: 10:36:11
notes data returned, display start: 10:36:12
Data table rows: 580
notes display complete: 10:36:12
The next time it runs there is a 14 second delay to display the same data????
notes update start: 10:36:54
notes data returned, display start: 10:36:54
Data table rows: 580
notes display complete: 10:37:08
Any ideas what is going on???
Thanks
I'm head scratching here, I can't work out why my richtextbox displays text quickly the first time but if i clear it and refill its much slower...
Its basically pulling notes from a SQL table and displaying them in a rich text box, data is returned from SQL very quickly and it appears to be the text box thats is slow... Code is as follows:
Code:
Private Sub UpdateNotes()
Console.WriteLine("notes update start: " & Now.ToLongTimeString)
NewNotesTB.Clear()
S_NotesRTB.Clear()
Dim NotesDT As New DataTable
Dim NewLine As String = Environment.NewLine
Dim CurrentSQLNotes As New cDetails
NotesDT = CurrentSQLNotes.Notes_Get(S_SIDTB.Text.ToString)
Console.WriteLine("notes data returned, display start: " & Now.ToLongTimeString)
Console.WriteLine("Data table rows: " & NotesDT.Rows.Count)
For Each Row As DataRow In NotesDT.Rows
S_NotesRTB.Text += "Created On: " & Row.Item("SN_DateTime").ToString()
S_NotesRTB.Text += " by " & Row.Item("SN_UserID").ToString()
S_NotesRTB.Text += " :- " & Row.Item("SN_Notes").ToString()
S_NotesRTB.Text += NewLine
S_NotesRTB.Text += NewLine
Next Row
NotesDT.Dispose()
Console.WriteLine("notes display complete: " & Now.ToLongTimeString)
End Sub
The first time it runs the time stamps are:
notes update start: 10:36:11
notes data returned, display start: 10:36:12
Data table rows: 580
notes display complete: 10:36:12
The next time it runs there is a 14 second delay to display the same data????
notes update start: 10:36:54
notes data returned, display start: 10:36:54
Data table rows: 580
notes display complete: 10:37:08
Any ideas what is going on???
Thanks