简体   繁体   中英

How to save RichTextBox text to a text resource file?

I have created a text file named 'Notes' in the resources of my project and want to load/save the text of a RichTextBox to it. I tried using MyProject.My.Resources.Notes in the path. It doesn't show any error in the code window but when I run it, it shows an error.

Here's what I'm using to load the text:

RichTextBox1.Text = System.IO.File.ReadAllText(MyProject.My.Resources.Notes) 

Here's what I'm using for saving it:

System.IO.File.WriteAllText(MyProject.My.Resources.Notes, RichTextBox1.Text) 

This is not a duplicate. I did not get an answer from the other question

Why don't you use a regular file which always works fine or a database?

Edit: maybe this helps? www.dondraper.com/2011/01/easily-save-and-retrieve-application-and-user-settings-in-vb-net-or-c-apps/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM