|
-
Aug 30th, 2008, 09:42 AM
#1
Thread Starter
Addicted Member
[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?
-
Aug 30th, 2008, 12:01 PM
#2
Lively Member
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
whats the benefit of beeing rated?

-
Aug 30th, 2008, 06:46 PM
#3
Thread Starter
Addicted Member
Re: [2008] RichTextBox does not allow newlines&backspace throws cursor into end of te
 Originally Posted by Nerd44
Very interesting links, thank you mate !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|