LineNumAtCharPos starts counting at 0, so in both solutions you have to add 1 to the result.
test:
put a textarea and a button on a window then the following code in the button’s action event:
[code] For i As Integer = 1 To 10
TextArea1.AppendText Str(i)
If i <10 Then TextArea1.AppendText EndOfLine
Next i
MsgBox Str(TextArea1.LineNumAtCharPos(TextArea1.Text.Len))
TextArea1.AppendText EndOfLine
MsgBox Str(TextArea1.LineNumAtCharPos(TextArea1.Text.Len))
[/code]