How to read from TextBox LineByLine

BitSmithy 2,141 Reputation points
2020-01-22T12:51:36.44+00:00

I have a TextBox with AcceptsReturn="True"

Now I want to read from it line by line
I tried code:

        string[] modelLines;  
        modelLines = ModelTextBox.Text.Split('\n');  

But it doesnt work, how to read from TextBox line by line?

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

Accepted answer
  1. Richard Zhang-MSFT 6,936 Reputation points
    2020-01-22T13:13:05.17+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    In TextBox, the default line separator is \r, so try this:

    var modelLines = ModelTextBox.Text.Split('\r');  
    

    Thanks.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.