Limit lines in Text Area to the last 15 lines

I am trying to limit the number of lines of text in a Text area and it is not working by putting the text in an array by splitting at the EndOfLine character but no matter how many lined in the TextArea the array length is always 0 as if there is no EndOfLine. Is there a better way to do this? Here is the code I’m using.

Public Sub TrimStatusLines()
Var StatusLines() As String
Var StatusText As String = Window_Main.TextArea_Status.Text
StatusLines = StatusText.Split(EndOfLine)
If StatusLines.LastIndex > 15 Then
Var NewStatus As String
Var Startline As Integer = StatusLines.LastIndex - 15
For i As Integer = Startline To StatusLines.LastIndex
NewStatus = NewStatus + StatusLines(i) + EndOfLine
Next
Window_Main.TextArea_Status.SelectedText = NewStatus
End If
End Sub

Try replacing the line endings first.

Public Sub TrimStatusLines()
Var StatusLines() As String
Var StatusText As String = Window_Main.TextArea_Status.Text
StatusLines = StatusText.ReplaceLineEndings(EndOfLine).Split(EndOfLine)
If StatusLines.LastIndex > 15 Then
Var NewStatus As String
Var Startline As Integer = StatusLines.LastIndex - 15
For i As Integer = Startline To StatusLines.LastIndex
NewStatus = NewStatus + StatusLines(i) + EndOfLine
Next
Window_Main.TextArea_Status.SelectedText = NewStatus
End If
End Sub

That did the trick Anthony! THANKS!

Happy to help! Please mark the solution so others can easily see it in the future.