开发者

Why doesn't the '\n' performs a new line in this situation?

I'm getting some text from a database, so I want to view them in a TextBox object. The text in the DB has \n character开发者_运维知识库 to represent a new line, but when I bind the text to the TextBox, the \n still appear without being transformed to new lines!

I've tried the "\r\n" instead with no results!

What's wrong!


If you look at the string in the debugger, I'm willing to bet that it has an \\n in it, not an \n. \\n will be displayed as \n, but \n will be displayed as a newline

string s = "Hello\\nWorld";  // Displays 'Hello\nWorld'

s = "Hello\nWorld";          // Displays 'Hello
                             //           World'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜