I need to open a text file with ~4MB in a RichTextBox, but the end of the text was "trimmed".
How do I override a RichTextBox.MaxLength Int32 limit?
I need to open a text file with ~4MB in a RichTextBox, but the end of the text was "trimmed".
How do I override a RichTextBox.MaxLength Int32 limit?
I'm not sure how much text RichTextBox can handle, but I believe MaxLength only applies to text the user enters. If you set .Text directly it should be able to go past MaxLength, unless MaxLength is already at the maximum.
The default for RichTextBox.MaxLength is 2GB, so with a 4MB file this is not going to be your problem.
Besides that, you can set the text limit(max limit is limited by your memory) by setting its length, something like:
if (textToAdd.Length > richTextBox1.MaxLength)
...it doesn't sound good loading that much amount of data in the box; you may run into out of memory
hiccups!
This answer may help.
--EDIT--
Must, if you load, then you can load chunks from the file. And as user clicks the scroll button(up/down) load that chunk of the file; sounds like some code - but Must, if you load! Just thinking!
OK the max size of the RichTextBox is 2,147,483,647 that is a lot of typing, if you are thinking copy past it may better to read in the data as opposed to copying to a RichTextBox.