How to get text of given lines ?

SyntaxEditor for Windows Forms Forum

Posted 12 years ago by Hassan
Version: 4.0.0283
Hi ! How can I get text of the a particular line?
For example I have to get the text of line no 5. What will I have to do?


[Modified at 11/16/2009 01:48 PM]

Comments (2)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA

You can convert a document position (line/col) to an offset with editor.Document.PositionToOffset(). Then use editor.Document.GetSubstring() with the offset range.

Or if you only want a single line you can do editor.Document.Lines[index].Text.

Actipro Software Support

Posted 12 years ago by Hassan
Thanks a lot.
The latest build of this product (v21.1.1) was released 17 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.