Dong Lam Trien

Dong Lam Trien

  • 732
  • 986
  • 147.4k

Why when I add a space to the Label string heterogeneous length?

Oct 14 2020 10:38 PM
Why when I add a space to the Label string heterogeneous length of the string ? 
 
Suppose I have 4 Label.Text corresponding to 4 series: Basic salary, Business salary, Responsibility allowance, Attraction allowance. When running the program I can change the string "Responsibility allowance" with another string "Attribution allowance" for example. I take the basic salary series as the standard for other series, from the basic salary series, find the 2-dot character position ":" is position 36 through the function Label1.Text.IndexOf (":"). The other strings that are inserted at the run are "Responsibility allowance" and "Attraction allowance" string, to display four strings uniformly with a 2-dot ":". I insert a space in the string so that the string length at the 2-dot character is equal to the 36th position but when displaying the characters at position 36 as the 2-dot is not equal, I see if the character is different if white characters are less often inserted in string will re-attach, why is that? you see my photo file. How do I write code to overcome this situation ?
http://www.mediafire.com/view/0t4b8jum5g1g6uu/ErrSpace.jpg/file 

Answers (2)