Click here to Skip to main content
15,893,337 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
I want to display a large *.txt file to RichTextBox. The size is about 7MB.
When I use RichTextBox.LoadFile() method, it takes a long time(about 2 minutes) util it shown up. 
But if I use wordpad or any other free editors, it displayed very soon.
How can I improve the performance?
Please give me some advice.
 
The code is:
RichTextBox1.LoadFile(FilePath, RichTextBoxStreamType.RichText);


What I have tried:

i tried use memorystream to load,but it still very slow
Posted
Updated 9-Sep-16 5:14am
Comments
Patrice T 9-Sep-16 11:29am    
You forgot to copy signature from original question.

1 solution

You copied this question exactly, word for word. I suggest you look at the responses from where you copied it for your answer.

Performance issue when using RichTextBox.LoadFile method to load a large *.rtf file.[^]

Other links:

c# - What is the fastest way to load text file into RichTextBox? - Stack Overflow[^]

richtextbox.loadfile slow c - Google Search[^]
 
Share this answer
 
v2
Comments
xuyunhai20160827 9-Sep-16 20:37pm    
when i read file about 27M use File.ReadAllText, but it also takes about 17 minutes,can any other way to update speed

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900