I have a string variable. And it contains the text:
\0#«Ия\0ьw7к\b\0E\0њI\0\0ЂЪ\n
When I try to add it to the TextBox control, nothing happens.Because \0 mean END.
How do I add text as it is?
UPDATE: The text is placed in the variable dynamically.Thus, @ is not suitable.
Is the idea that you want to display the backslashes? If so, the backslashes will need to be in the original string.
If you're getting that text from a string literal, it's just a case of making it a verbatim string literal:
string text = @"\0#«Ия\0ьw7к\b\0E\0њI\0\0ЂЪ\n";
If want to pass in a string which really contains the Unicode "nul" character (U+0000) then you won't be able to get Windows to display that. You should remove those characters first:
textBox.Text = value.Replace("\0", "");
"\\0#«Ия\\0ьw7к\\b\\0E\\0њI\\0\\0ЂЪ\\n"
or
@"\0#«Ия\0ьw7к\b\0E\0њI\0\0ЂЪ\n"
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