Hi,

I have a RichTextBox control and this Form code:

VB Code:
  1. Imports System.Text.RegularExpressions
  2.  
  3. Public Class Form1
  4.     Private Sub RichTextBox2_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RichTextBox2.TextChanged
  5.         Dim text As String
  6.         text = RichTextBox2.Text
  7.  
  8.         Dim re As New Regex("(bold)")
  9.         text = re.Replace(text, "{\b $1}")
  10.  
  11.         text = "{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard " & text & "}"
  12.  
  13.         RichTextBox2.Clear()
  14.         RichTextBox2.SelectedRtf = text
  15.     End Sub
  16. End Class
If you try it, you will notice that it works nicely for word 'bold' but if u try to backspace (remove) anything in the middle of the text, it throws the cursor back to end...

Also, the Enter key for newlines is not working. Help?