Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
I am trying to load 100 MB of Text file in rich text box, but the application gets hang or some times it gives out of memory exception.

Finally I loaded successfully . I loaded the file initially in the richtextbox i.e. after selecting the file . But again the problem continues.
i)when searching with keyword - memory out of exception occurs (Find method)
richTextBox1.Find(sSearchText, start, options); memory out of exception occurs (Find method)
ii) when i try to load the second file - memory out of exception occurs.

I am using VS2008(.Net framework3.5)

Is there any alternate to richtextbox control (open source)?


with reagrds,
Vishnuvarthan.V
Posted
Comments
Sandeep Mewara 11-May-12 1:39am    
100 MB! You really want to implement it?

1 solution

Why the heck are you loading a 100MB text file into a RichTextBox?

Think about it: How much of this text can the user see at a time? 2K?, maybe 4K? So you dump 25,000 to 50,000 pages of data on him, and are surprised when you get out of memory exceptions? Particularly with a RichTextBox where the text can be formatted, and each change of format may require different fonts for example, each of which needs a font handle in the system? How long is it going to take to load that much data in the first place on a "Normal" user PC?

Don't do it - find a better way to display your data - all you are doing is taking the lazy way for you at the expense of the poor sod who has to try to work with it every day.
 
Share this answer
 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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