0

I am developing an app which reads the info from a barcode scanner then parses the information.

when I scan the information into a text box the '\n' line feed character is being filtered out from the textbox. I have made accept returns = true but in still getting the same issue.

when I scan the information into notepad I am getting the \n line feed character so I know it is present. I also get \r\n which are different from the line feeds which my application is able to read.

my question is, how can I make the text box accept line feeds

Stavros
  • 147
  • 2
  • 14
  • 1
    You have to provide at least your code and the model of the Barcode scanner so that People here could help you. – Samvel Petrosov Jun 26 '17 at 15:55
  • Possible duplicate of [UWP application not reading line feed](https://stackoverflow.com/questions/44723118/uwp-application-not-reading-line-feed). – AVK Jun 26 '17 at 16:20

1 Answers1

1

You cannot. The Windows TextBox only accepts \r\n as line breaks. \n will be ignored.

To represent a new line for each \n character, you'll have to replace it with the Windows representation of a new line.

var input = GetInputFromScanner();
var cleanInput = input.Replace("\n", Environment.NewLine);
// Assign "cleanInput" to your "TextBox" instance
Stefan Over
  • 5,851
  • 2
  • 35
  • 61