views:

78

answers:

1

Hi, I'm trying to make a TextBox with syntax highlighting (for (HTML/CSS) in VB.NET 2008.

I figured that if I use RichTextBox.Find(), I can color specific text, but then I need to call RichTextBox.DeselectAll().

The problem is that the the cursor jumps to the beginning of the RTB.

I'm using WinForms.
Any ideas?

+3  A: 

You can get and set the cursor position using the SelectionStart property.

Therefore, you can write,

Dim selStart As Integer = rtb.SelectionStart
'Do things
rtb.SelectionStart = selStart
SLaks
thanks for the edits. :) Gonna try that and see if it works.
Moshe