Products Technologies Demo Docs Blog Support Company

How to Get the Last Line in TX Text Control ActiveX

I have been asked today how to check, if the cursor is in the last line. Here is the resulting code snippet, which includes the extra check for the last text position in the document: Private Function IsLastLine() As Boolean If TXTextControl1.SelStart = Len(TXTextControl1.Text) Or TXTextControl1.GetLineFromChar(TXTextControl1.SelStart) + 1 = TXTextControl1.GetLineCount Then IsLastLine = True Else IsLastLine = False End If End function If you have any suggestions or comments please feel free…

How to Get the Last Line in TX Text Control ActiveX

I have been asked today how to check, if the cursor is in the last line.

Here is the resulting code snippet, which includes the extra check for the last text position in the document:

Private Function IsLastLine() As Boolean
    If TXTextControl1.SelStart = Len(TXTextControl1.Text) Or TXTextControl1.GetLineFromChar(TXTextControl1.SelStart) + 1 = TXTextControl1.GetLineCount Then
        IsLastLine = True
    Else
        IsLastLine = False
    End If
End function

If you have any suggestions or comments please feel free to drop us a line.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

ActiveX

TX Text Control ActiveX is a royalty-free, fully programmable rich edit control that offers developers a broad range of word processing features in a reusable component. It provides comprehensive text formatting, powerful mail merge features and all word processing key concepts such as table support, images, headers and footers and page sections.

See ActiveX products

Related Posts

ActiveXSample

FontItalic on CTRL+i with TX Text Control ActiveX

TX Text Control inserts a tab character when the key combination CTRL+i is used. This short code sample shows you how to trap these keystrokes in order to implement some other behavior, such as…


ActiveXSample

Modifying Styles in TX Text Control ActiveX

TX Text Control .NET for Windows Forms offers extensive classes to modify document styles. The FormattingStyle class is the base class for the two different supported style classes: InlineStyle…


ActiveX.NETSample

Open Documents with an Offset

TX Text Control ActiveX offers an Offset parameter to export a document with a specific file offset position. This offset can be used to save a custom file header that could contain additional…


ActiveXSample

'Change Case' in TX Text Control ActiveX

A desirable feature of a word processing application is to change the case of a word, sentence or entire document. This sample application shows you how to implement the different cases known from…


ActiveXSample

Indents and Numbered Lists

If you use the TX Text Control ActiveX button bar to insert a numbered list, you will get a different result than when you insert a numbered list simply using the ListType property. Why is this?…