Rich Text Box Selection problem 
Author Message
 Rich Text Box Selection problem

I am working with a rich text box, and trying to select a specific index in
the text. When I use a TextBox it works fine, when I use the RTF control,
the selection is inconsistant. Has anyone seen this? See below for how to
setup the test.

- Create a new Windows Form project
- Add a text box (TextBox1) & set the MultiLine property to True
- Add a rich text box control (RichTextBox1)
- For both text boxes, in the Lines property, add this text:
"This is the
first
test
of
many more to come"

- Add 2 buttons (Button1 & Button2)
- Add this code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

RichTextBox1.Select(30, 1)

RichTextBox1.Select()

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click

TextBox1.Select(30, 1)

TextBox1.Select()

End Sub

Now run the project and click the buttons, one selects a space and the other
selects an "m".

TIA



Tue, 08 Feb 2005 04:37:50 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. RICH TEXT BOX Control- Bug re Multiple Selection of fields

2. RICH TEXT BOX Control- Bug re Multiple Selection of fields

3. Colour Text Box/Class Wrapper for Rich Text Box

4. Newbie question: Rich Text Box vs. Text Box

5. help: formatting rich text box/text box

6. Rich Text Box vs. Text Box Scrolling

7. Rich Text Box or text box control

8. Looking for APIs for text box and Rich text box

9. Becoming rich with a rich text box

10. Rich Text Box: Can I remove text and keep multicolored text

11. Rich Text Box Problems!

12. Rich Text Box Problem

 

 
Powered by phpBB® Forum Software