none
Textbox displays end of string 0x00 as box character in Windows XP

    Pertanyaan

  • 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?

    20 Februari 2012 18:28

Jawaban

  • 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.

    Terry

    • Ditandai sebagai Jawaban oleh tncoder 21 Februari 2012 17:35
    21 Februari 2012 17:35

Semua Balasan

  • Hi Tncoder,

    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.

    Best regards,


    Mike Feng
    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 8:13
  • 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.



    • Ditandai sebagai Jawaban oleh tncoder 21 Februari 2012 17:35
    • Tanda sebagai Jawaban dihapus oleh tncoder 21 Februari 2012 17:35
    21 Februari 2012 15:23
  • 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.

    Terry

    • Ditandai sebagai Jawaban oleh tncoder 21 Februari 2012 17:35
    21 Februari 2012 17:35