5

My textbox have a some properties like these

   txtBox.Cangrow = False

   txtBox.CanShrink = False

   Uncheck allow height to increase and decrease.

This textbox use for display value which receive from dataset. Sometime data is too long. So I need to know How to automatically decrease font size for matching with width of textbox?

Fame th
  • 1,018
  • 3
  • 17
  • 37

2 Answers2

11

You'll need to manually determine which font sizes are required for stings of a certain length. You can then put an expression in the Font -> FontSize property as follows

=iif(len(Fields!myString.Value) > 20, "8pt", "10pt")

It's not possible to dynamically shrink the text to fit the textbox.

Jonnus
  • 2,988
  • 2
  • 24
  • 33
  • What possible if I check text is too long by a number of line? example if it has multiple line, Font size will be decreased. Because of I need to show just single line in textbox. – Fame th Sep 14 '15 at 08:29
0

In my case the following worked best for me when dealing with dynamic numbers in a text field.

=iif(len(Fields!myString.Value.ToString) > 20, "8pt", "10pt")