Is the line delimited by a hard return, or do you mean each physical line as
displayed, regardless as to whether there is a line termination character or
not? If you're looking for lines delimited by a hard return, and want those
into an array, just use Split ...
x() = split(RTF1.Text, vbcrlf)
If you need to use the physical non-delimitered line, you have to resort to
the API ... this demo, although for text boxes, works against the RTF
control as well ...
'll need to
modify it to return a single line in each call.
MVP Visual Basic
Please respond only to the newsgroups so all can benefit.
: >> Okay, so you have a RichTextBox control and it has text in it.
: do you want to do with the text after you split it up? Just output it
: to a text file? Cut to the chase. What are you going to do with the
: text in the RTB? Once you explain that, you might get a more useful
: I want to be able to read each line of text in the RichTextBox and
: each line into a string array.
: As said, the approach I came up with to start was to dump the
: contents into a file, then use OPEN and LINE INPUT to read back the
: of the file and store the information into my array. I just figured
: there was a more
: direct way so I wouldn't need to save to file, then open the file and
: read it a line
: at a time - I figured why can't I read a line at a time directly from
: the RichTextBox.
: Thank you.