20 Februari 2012 18:28
When I add string data to a textbox, such as textBox.AppendText("my text"), it shows the end of string character, 0x00, as a box. This does not happen under Windows 7 but does in Windows XP. It is very annoying to see the box at the end of every string that is displayed. How can I prevent it from showing?
- Dipindahkan oleh Esther FanMicrosoft Employee, Moderator 23 April 2012 0:59 (From:Visual Studio Class Designer)
21 Februari 2012 8:13Moderator
Thank you for posting on this forum.
I didn't repro this scenario by your code. Anyway, I suggest you try to remove the character 0x00 since a string always end by 0x00, you don't need to append it manually. And try again.
MSDN Community Support | Feedback to us
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
21 Februari 2012 15:23
I've tried all sorts of ways to fix this and nothing works yet. I've done :
myString.Replace("\0", ""); myTextBox.AppendText("this is more text"); myTextBox.Text.Replace("\0", "") It doesn't fail if I do: myTextBox.Text = "This is a test".
This only shows up on any XP machine I try. It doesn't fail on Windows 7.
21 Februari 2012 17:35
I found something interesting. If I do myTextBox.Text = myTextBox.Text + "this is more text\n\r"; it works. However, if I use myTextBox.AppendText("this is more text\n\r"), I get the 0x00 or boxes appended to the string.
- Ditandai sebagai Jawaban oleh tncoder 21 Februari 2012 17:35