I'm using this syntax checker and it works.
But this code will make my program run slowly.
Any suggestion?![]()
(KeywordList and ObjectTagList are array.)
VB Code:
Dim iPos As Integer 'save the current cursor position iPos = rtfText.SelStart 'prevent the window from changing LockWindowUpdate rtfText.hwnd 'clear all highlighted rtfText.SelStart = 0 rtfText.SelLength = Len(rtfText.Text) rtfText.SelColor = vbBlack rtfText.SelBold = False 'Search over RTB For i = 0 To Len(rtfText.Text) - 1 For s = 0 To UBound(KeywordList) hlstr = KeywordList(s) res = rtfText.Find(hlstr, i, Len(rtfText.Text), 14) If res <> -1 Then rtfText.SelStart = res rtfText.SelLength = Len(hlstr) rtfText.SelColor = vbBlue End If Next Next For i = 0 To Len(rtfText.Text) - 1 For s = 0 To UBound(ObjectTagList) hlstr = ObjectTagList(s) res = rtfText.Find(hlstr, i, Len(rtfText.Text), 14) If res <> -1 Then rtfText.SelStart = res rtfText.SelLength = Len(hlstr) rtfText.SelBold = True End If Next Next 'restore the cursor position rtfText.SelStart = iPos 'unlock the window LockWindowUpdate 0




Reply With Quote