I want to load huge files into a read-only RichTextBox. The problem is RichTextBox uses too much memory and will eat off all the system-resources if I try to load a 400MB file.
What I was thinking of doing is the following:
- When one opens the 400MB file, the vertical scroll-bar of the RichTextBox updates itself to reflect the real size of the file
- Load the first 10MB chunk of the 400MB file to the RichTextBox
- Set the RichTextBox Vertical Scrollbar to reflect the actual size of the file (400 MB) rather than the loaded 10MB's.
- When the user moves the scroll-bar, the corresponding 10MB chunk will be read from the file and displayed in the RichTextBox
This aproach, will actually handle extremely huge files in a RichTextBox and will require very little memory to do so.
The problem is this is my first time using VC++ NET and I have no idea on how to do this.
Can someone please help me ?
Please provide a working example.