[2008] RichTextBox does not allow newlines&backspace throws cursor into end of text.
Hi,
I have a RichTextBox control and this Form code:
VB Code:
Imports System.Text.RegularExpressions
Public Class Form1
Private Sub RichTextBox2_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RichTextBox2.TextChanged
Dim text As String
text = RichTextBox2.Text
Dim re As New Regex("(bold)")
text = re.Replace(text, "{\b $1}")
text = "{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard " & text & "}"
RichTextBox2.Clear()
RichTextBox2.SelectedRtf = text
End Sub
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?
Re: [2008] RichTextBox does not allow newlines&backspace throws cursor into end of te
u should not exchange the whole text each time.
the best, i think is, only to change the word which is just written. This is quit complicated, but it reduces flickering.
It seemed to me on http://geekswithblogs.net/pvidler/ar...10/14/182.aspx there are very efficient approaches published. Dont worry about c#, u can use a codeconverter, eg http://codeconverter.sharpdevelop.ne...Converter.aspx
Re: [2008] RichTextBox does not allow newlines&backspace throws cursor into end of te
Quote:
Originally Posted by Nerd44
Very interesting links, thank you mate ;)!