Results 1 to 5 of 5

Thread: [RESOLVED] Differece

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Resolved [RESOLVED] Differece

    i have a RichTextBox (with Formatted Or Not Formatted text) in my form which is connected to Database of Access,
    im reading values by this code
    Code:
    RTB.TextRTF = Rs!field1
    it shows formatted text in the RTB but when i move to next record whose field1 is not formatted it shows the same formatting as previous record. how can i solve this problem?

  2. #2
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Differece

    You may have to give selective formats in the RTB. Using SelStart, SelLength to select the text and use selective formats such as SelBold, SelColor, SelItalic, etc ... accordingly.

    And How are you saving the text in the DB? is it just text or text with format?
    when you are saving, you may try to save the RTF text using TextRTF or SelRTF

    IIF(Post.Rate > 0 , , )

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: Differece

    saving by this code
    Code:
    Rs!field1=RTB.TextRTF

  4. #4
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Differece

    I tried to simulate your work by this code. Using the RTF code in the RTF file.
    It works fine I guess

    Code:
    Private Sub Command3_Click()
        RichTextBox1.TextRTF = "{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}}" & vbCrLf & "\viewkind4\uc1\pard\lang1033\f0\fs17 RichTextB\b ox1fsdg;dflj" & vbCrLf & "\par d;flkjgkl;" & vbCrLf & "\par" & vbCrLf & "\par xcvxcv\ul xcvxcv\ulnone" & vbCrLf & "\par }"
    End Sub
    
    Private Sub Command4_Click()
        RichTextBox1.TextRTF = "{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}}" & vbCrLf & "\viewkind4\uc1\pard\lang1033\f0\fs17 RichTextBox1" & vbCrLf & "\par }"
    End Sub
    Anyway, one sugestion may be, try to save the rtf from the DB to a RTF file and load that file to the RTB using RichTextBox.LoadFile

    Or just clear the RTB before setting next row in the dB.

    Or keep the RTF code with no text and no formmating (Hard Coded) and use that before assigning. This is that in my pc
    Code:
    {\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}}
    \viewkind4\uc1\pard\lang1033\f0\fs17 
    \par }
    mind that you need to add vbcrlf to line ends.
    Try and see.

    IIF(Post.Rate > 0 , , )

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: Differece

    i fixed this problem by using this code.
    Code:
    text1.text=""
    text1.textrtf=Rs1!field1

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