Thanks Everybody !!
I had searched a few hours before posting and then soon stumbled into
the "TextBoxBase" category of methods. My search skills are pathetic!
The RTB must have some powerful controls buried deep within ... but
not enough examples on programmatically maneuvering within its buffer.
I long for a simplistic tool >>
textBox1.RemoveRange(int lineStart, int lineCount);
Just like in ArrayList ... but then things would be just too easy?
I've tried searching for the line feed with no success as of yet.
string findMe = "\n";
int indexToText = textBox1.Find(findMe, 0, RichTextBoxFinds.None);
The above does not work. I know those line feeds are not stripped out
because you can allow wrapping and then shrink the control to force
wrapping ... followed by expanding the control that returns the lines
to unwrapped. Being able to search for a >> chr(10), Char(10), '\n',
or however you properly specify a non printing character would be nice
considering "\n" does not work.
This work is part of a large data file viewer with small resource
usage project. I am trying to create this project for both future
usage and as a learning aid. I initiate the read at an arbitrary
location within the data file. Typically near the end of what are
often 50+ MB files.
My disk input is simple using this method >>
FileStream.Read(byte[] array, int offset, int count);
Then I trim the partial sentences away using a logic loop that
searches for byte(10). The front trimming is simply >>
int trim0 = 0;
while(byteArray[trim0] != 10) ++trim0;
long Position_0 = ++trim0;
Then I split the trimmed byteArray into lines and store them in an
ArrayList. This ArrayList is my buffer; however, it is a waste of
memory space!! There is no reason why the RTB could not be used as the
buffer storage space if adequate control was achieved.
As it is now ... I can clear the RTB and reconstruct it from the
ArrayList whenever I jump to another area of the data file. Good RTB
control would allow local scrolling to be much more efficient. I'd
really like the RTB caret to trigger buffer events. But learning about
that caret is another issue in itself.
This learning project of mine is certainly kickin me around. Someday I
will post it in its entirety and hopefully some other newbs can
benefit from it. Getting some guru level critique will be a very
humbling and educational event I look forward too.
Thanks again for all the comments!! Every suggestion and nudge gets me
that much closer to success.
-- Tom