I'm having a problem with storing amazing amounts of text in a rich TextBox.
I'm trying to read a text file fairly big( anywhere from 90mb to 450mb), and put what I've read in a rich textbox. It works in a simple program, but when I do in a complicated program I get an OutOfMemory exception.
One thing to note is that when I exit my simple program, I get an OutOfMemory exception right before the program returns 0.
Here is my simple program's code:
array<String^>^ strArray;
StreamReader^ sr;
String^ dummyStr;
int dummyInt;
sr = gcnew StreamReader("C:\\testsize.txt");
while( (dummyStr = sr->ReadLine() )!= nullptr)
{
dummyInt++;
}
sr->Close();
sr = gcnew StreamReader("C:\\testsize.txt");
strArray = gcnew array<String^>( dummyInt );
for(int i=0; i < strArray->Length; i++)
{
strArray[i] = sr->ReadLine();
}
richTextBox1->Lines = strArray;
I have a similar snippet of code in my project, and the exception pops up when I do the richTextBox1->Lines = strArray line.
I have read the documentation of the rich textbox, and it says the max limit is 64KB worth of characters, but that makes sense halfway through, as I can load the text, but I guess the program has a problem dumping it afterwards.
Any ideas? I have been trying to find maybe some custom controls without a limit, but to no success so far.