I'm extending Exception to implement a setter on the Message property. And this works just fine. But somehow this:
CustomException.Message = "Test" + Environment.NewLine + "Test Again";
Becomes this:
"Test\r\nTest Again"
I've also tried this, with no luck:
CustomException.Message = @"Test
Test Again";
Any ideas?
line break (plural line breaks) (typography) A point in writing where text that would normally continue on the same line starts at the beginning of a new line. (computing) A character indicating that subsequent characters should appear on a separate line of text; newline, line feed.
An exception occurs when a package or shipment encounters an unforeseen event, which could result in a change to the expected delivery day. Examples of exception include: address unknown, damage to shipment, or signature not received.
Following are the different ways to handle exception messages in Java. Using printStackTrace() method − It print the name of the exception, description and complete stack trace including the line where exception occurred. Using toString() method − It prints the name and description of the exception.
<br>: The Line Break element. The <br> HTML element produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division of lines is significant.
Environment.NewLine
IS \r\n
(at least on Windows, anyway...)
\r\n characters will be converted to new line when you display it by using message box or assign it to text box or whenever you use it in interface.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With