Results 1 to 4 of 4

Thread: RichTextBox (i hate it!)

  1. #1

    Thread Starter
    Hyperactive Member Asaf_99's Avatar
    Join Date
    Jul 2000
    Location
    Israel
    Posts
    335
    Hi All!
    I have a FileListBox named fleNotes, a RichTextBox called rtbNote.
    I have this code:
    Code:
    Private Sub fleNotes_Click()
    
    If fleNotes.filename = "" Then
        MsgBox "No note selected!"
    Else
        rtbNote.LoadFile fleNotes.Path & "\" & fleNotes.filename
    End If
    End Sub
    I want this code to open the file in rtbNote but it doesn't...
    It was supposed to load a file made with this code that has txtNewNote which when saved, it is the filename.txt, a RichTextBox named rtbNewNote which is the content of the file, and a commandbutton named cmdCreate.
    This is the code:
    Code:
    Private Sub cmdCreate_Click()
    rtbNewNote.SaveFile App.Path & "\Notes\" & txtNewNote.Text & ".txt"
    End Sub
    This workd but it makes the content something close to gibberish.

    Can anybdy help me???
    Asaf Sagi

    ICQ: 61917199
    E-Mail: [email protected]

  2. #2
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    When you use the SaveFile and LoadFile methods of a RichTextBox, you should specify the right format, especially for saving.
    Code:
    'to save in normal text 
    RichTextBox1.SaveFile "filename.txt", rtfText
    
    'to save in richtext
    RichTextBox1.SaveFile "filename.rtf", rtfRTF
    You should specify the correct format when loading as well. I think RTF format is the default, so if you're using a normal text file this could be why you see gibberish (just my educated guess... may or may not be the case.) Hope this helps.
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

  3. #3

    Thread Starter
    Hyperactive Member Asaf_99's Avatar
    Join Date
    Jul 2000
    Location
    Israel
    Posts
    335
    Ok, it doens't show gibberish, now that's a step forward.
    Buuuuut... The text is transperent and I have to select the text and paste it to another place in order to see it.
    I solved it by doing an invisible RichTextBox and when I load the file into the invisible RTB then it will do this:
    Code:
    rtbVisible.Text = rtbInvisible.Text
    This works perfectly fine but does anybody know how to bypass this? There's gotta be a way.
    Asaf Sagi

    ICQ: 61917199
    E-Mail: [email protected]

  4. #4

    Thread Starter
    Hyperactive Member Asaf_99's Avatar
    Join Date
    Jul 2000
    Location
    Israel
    Posts
    335
    Hmmmm...
    Never mind!
    My computer has decided to make it work!
    Thanks for your help, man!
    Asaf Sagi

    ICQ: 61917199
    E-Mail: [email protected]

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