How can I load a pre-existing .txt file as a .rtf file in my C# code if I want to display it on a richTextBox? I am running Visual Studios Windows Application.
Thank you very much.
How can I load a pre-existing .txt file as a .rtf file in my C# code if I want to display it on a richTextBox? I am running Visual Studios Windows Application.
Thank you very much.
Try
string text = File.ReadAllText("filename.txt");
MyRichTextBox.Rtf = text; // oops, flying blind here
You might also try
MyRichTextBox.LoadFile("filename.txt", RichTextBoxStreamType.PlainText);
edit: corrected to add RichTextBoxStreamType
parameter.