Funky Square replaces Tab-Space in Label Control

I have multiple tab areas with my text inside a TextBox and when I set the Text property of the Label control to the Text property of the Text Text it loses tab spaces and replaces them with squares.

Can someone explain why this is happening?

+2


source to share


3 answers


This may not be the best solution. But this is the only one I came up with and it works:



control.Text = control.Text.Replace ("\ t", "");

+2


source


I'm just guessing here:

A tab is a control character. I am assuming that the Label control replaces all characters where it does not have a funky square font character.



However, the TextBox will have code to display the tab (for example, 4 spaces).

+2


source


Tabs are not replaced, they simply are not handled by the Label control.

The TextBox control handles tabs and makes space for the next tab. The Label control does not handle tabs other than any other character, so it just displays as is.

Since the tab character is not a visible character, it does not have any glyph in the font, so the "missing character" character is displayed instead, which is a square.

+1


source







All Articles