-
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???
-
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.
-
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.
-
Hmmmm...
Never mind!
My computer has decided to make it work!
Thanks for your help, man!