Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27412

VS 2008 Rich Text Box endless loop

$
0
0
I found this code and customized it specifically for my application. All it does is change all The letter F to red in a richtextbox. It works in most cases but in certain instances, it gets thrown in an endless loop.

***************
Public Function highlight_F()
RichTextBox1.SelectAll()
RichTextBox1.SelectionColor = Color.Black
RichTextBox1.SelectionBackColor = Color.White
RichTextBox1.DeselectAll()

Dim FoundAtPosition As Integer
FoundAtPosition = RichTextBox1.Find("F")
RichTextBox1.SelectionColor = Color.Red
RichTextBox1.SelectionFont = New Font("Arial", 12, FontStyle.Bold)

Do Until FoundAtPosition < 0
RichTextBox1.SelectionColor = Color.Red
RichTextBox1.SelectionFont = New Font("Arial", 12, FontStyle.Bold)
FoundAtPosition = RichTextBox1.Find("F", FoundAtPosition + 1, RichTextBoxFinds.None)
Loop

End Function

Viewing all articles
Browse latest Browse all 27412

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>