tags:

views:

212

answers:

2

Have an instruction like this:

this.toolStripStatusLabel1.Text = 
      this.toolStripStatusLabel1.Text + "; OS=" +
      System.Environment.OSVersion.ToString();

If I concatenate OS with something that is more than 10 characters text is blank instead of being truncated. Is this a Bug ?

A: 
  • Check your font size
  • Ensure that the autosize is set to true
  • As suggested by Henk, check width of the label
P.K
autosize is true, in debug mode variable content is ok, width cannot be changed, but it expands to the whole window so no problem.
programmernovice
A: 

If you pause your program (place a breakpoint right after this happening), what does it say the text is? Empty, or is it still the complete string?

Btw, you can use += instead of repeating the name of the label.Text after the =-sign.

Phoexo
and on that note use string.format() or a stringbuiler if you are changing string contents a lot (like in a loop)... string are immutable.
YetAnotherDeveloper
But there is no loop here, and an SB would be overkill.
Henk Holterman