Results 1 to 4 of 4

Thread: RTF Formatting

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2002
    Posts
    129

    RTF Formatting

    Hi Guys & Gals.


    I have yet another problem which I hope you will save me from.

    if I had text to an rtf box using rtf code it works fine, but when I then add some more text it keeps the formatting of the previous text and not the format it should have.

    At the moment I am using the .textRtf property, is there something else I should be doing.

    Please help.

  2. #2
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: RTF Formatting

    You should use TextRTF only if you want to manipulate the document directly using RTF formatting code. You'll need to learn RTF syntax for this.

    The Sel* properties are much easier to use. (but slower).
    To append new text with different format, use this:
    (typing freehand...)
    VB Code:
    1. RTB.SelStart = Len(RTB.Text) 'move the insertion point at end
    2. ' apply formats -->
    3. RTB.SelBold = True
    4. RTB.SelColor = [i]NewColor[/i]
    5. RTB.SelItalic = True
    6. '
    7. RTB.SelText = "This is new text"

    On a sidenote,
    Unlike TextBox,TextRTF is the default property of RTB.

    As a rule of thumb, if you want to work with text WITHOUT formatting, use the Text property.
    or, if you want to work with text WITH formatting, use the Sel* properties.

    Here is a good RTB tutorial that helped me at the beginning. I hope it will help you.
    Also see Moeur's "RichTextBox Tips And Tricks" thread in the Codebank.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Dec 2002
    Posts
    129

    Re: RTF Formatting

    This isn't what I needed, thanks for your help anyway.

    I have managed to sort out my problem now

  4. #4
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: RTF Formatting

    Quote Originally Posted by DanDanDan1
    This isn't what I needed, thanks for your help anyway.

    I have managed to sort out my problem now
    If so then mark this thread resolved!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width