I have a multi-line textbox in my WinForms application, I set the WordWrap
property to true
.
But as you can see, when I set the Text
property to the following string, the line breaks at '-' character of ORD-082619/1023
.
myTextBox.Text = "ORD-082619/1020, ORD-082619/1021, ORD-082619/1022, ORD-082619/1023";
You could replace the regular hyphens with non-breaking hyphens:
myTextBox.Text = myTextBox.Text.Replace("-", "\u2011");
This will of course only work if you don't have any of those before and need to know which was which, (in which case you can keep the original version somewhere, maybe in the Tag ;-)