Indenting Text With RichTextBox 
Author Message
 Indenting Text With RichTextBox

I need to indent text using a RichTextBox but am having all kinds of
problems doing so. My procedure loops thru my MS-Access database from record
to record placing text onto a RichTextBox. This is a typical multiple-choice
test I am creating. I want the answer choices to be indented. I have not
found a good way to accomplish this in an automated fashion. Here is the
pertinent code I am using:

'  This line places just the text of a memo field into a hidden RichTextBox
(strips RTF)
rtfHidden.Text = "": rtfHidden.SelRTF = rst.Fields("stuChoiceA").Value

'  This line displays a student answer choice memo field data onto my main
RichTextBox
Text1.SelText = "(A). ": Text1.SelRTF = rst.Fields("stuChoiceA").Value

'  This line finds the exact same string as the previous line, highlights
the found match and indents
'  The highlighted text
Text1.Find "(A). " & rtfHidden.Text: Text1.SelIndent = 1000

'  This line deselects any text that may be selected
Text1.SelText=""

What occurs by this code is that my entire answer choice 'A' is deleted from
my main RichTextBox. I believe because the found text is highlighted and
because it is in a loop, it is eventually deleted the next time Text1.SelRTF
places data on the RichTextBox. I've tried many variations of this code with
no luck.

This code will work if I place it inside a command button and select it
after all the data has reached the RichTextBox. However, I want to have
indenting done automatically.

I may be out to lunch on the technique I am using, I am going off the help
info that came with VB.

Any ideas how I may be able to indent text while it is printing to a
RichTextBox inside a loop?

Tim Hirtle



Tue, 27 Jul 2004 01:15:33 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Richtextbox: How can I indent the second line upto the end of the paragraph

2. RichTextBox indenting???

3. Indent Richtextbox control

4. Indent Richtextbox control

5. Indent Richtextbox Control

6. Indent of a RichTextBox control

7. resetting default first line indent, hanging indent

8. Indenting Paragraphs in Text Formatted Email

9. Rich Text Box - First line indent

10. Make Rich Text Box indent when tab is hit, not change control

11. indent text when line wraps

12. Getting formatted text from Word into Richtextbox

 

 
Powered by phpBB® Forum Software