TLabel
has its maximum characters 255(ShortString) but I need more than that. What should I use?
No, there is no limit. I just tried to use a string with 1223 characters as the caption of a TLabel
, and that works. In code, however, a string literal cannot exceed 255 characters. But that is not a problem. Just do
Label1.Caption := 'This is a test. This is a test. This is a test.' +
'This is a test. This is a test. This is a test. This is a test.' +
'This is a test. This is a test. This is a test. This is a test.' +
'This is a test. This is a test. This is a test. This is a test.' +
'This is a test. This is a test. This is a test. This is a test.' +
'This is a test. This is a test. This is a test. This is a test.' +
'This is a test. This is a test. This is a test. This is a test.';
You can make the caption as long as you wish, but a single string literal, the text in the source code between ' and ', cannot exceed 255 characters. To construct a longer string,
use the string concatenation operator (+
) to concatenate shorter string literals.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With