question

BitSmithy-4663 avatar image
BitSmithy-4663 asked ·

How to read from TextBox LineByLine

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?

windows-uwp
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

RichardZhang-MSFT avatar image
RichardZhang-MSFT answered ·

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.

Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.