Find a particular word and change the color of it

BarryM

New member
Joined
May 19, 2009
Messages
3
Programming Experience
Beginner
HI im making a currently making a program called BATCH Studio.Theres just one particular part im stuck with which is changing is changing conditions and loop words to another color. Just like how vb changes the IF and FOR to blue and String. Iv managed to come up with this but doesent really work

Dim intPosition As Integer
Static intStart As Integer
Dim text As String = txtCode.SelectedText
Dim objType As Object
objType = CompareMethod.Text
intPosition = 1
intStart = InStr(intPosition, txtCode.Text, "if", objType)
If intStart > 0 Then
txtCode.SelectionStart = intStart - 1
txtCode.SelectionLength = 2
txtCode.SelectionColor = Color.Blue

End If

any tips on how to fix it would be appreciated
 
Please post in the forum that's most appropriate to the subject of your post, not just the first one you come to. Moved.

What you're asking for is difficult to do with the members of the RichTextBox because it requires a change to the UI, which will look very bad to the user. You might want to take a look at [ame="http://www.vbforums.com/showthread.php?t=517116"]this[/ame].
 
Question

When you say it does not work referiung to the code you posted. What does or doesn't it do? The word is not selected or the color is not changed?

TyB
 
Back
Top