Changing Caption Class Property At runtime.

I have placed a field on the form and i want to change the label caption of the field at runtime.

It is working when i click the properties of the text item and change the caption class to

"‘1,5,’ + ‘MyNewCaption’

Now i want to do the same through code. How to achieve this through code.

How can i set the field captionclass property on an event.



If you want to change the caption of lable se t the above expression in caption class property and change the Mynewcaption at run time…

or use text boxes in place of labels and change the source expression variable at run time…

set the above expre****ssion in caption class property

which expression please can you make it clear.

‘1,5,’ + txtMyCaption

Hi Mohana,


eg (Item Balance By Location)

  1. Item No.
  2. Item Brand
  3. Item Part No.
  4. Total Purchase- Location1
  5. Total Sales- Location1
    6.Total Purchase- Location X

1.Number of field Total Purchase should be ‘dynamically’ changes with number of location.
2.Caption of field should reflect on location code
Item No. |Total Purchase-Bangkok|Total Purchase-Chiang Mai|Total Purchase-Pattaya|
A001 |10 |7 |34

I tried not to modified codeunit 1, so i used a function to return code of location
so in my table field
total purchase-location1, caption class i place: ‘Total Purchase -’ + GetName(1)
total purchase-location2, caption class i place: ‘Total Purchase -’ + GetName(2)


i tried to modified your suggestions: ‘1,5,’ +GetName(1)


hi mohana,

i have 4 location A1,B2,C3,D4.

My item history table have 4 field where in their caption class i placed
Location1: ‘1,5,’ + GetName(1)
Location2: ‘1,5,’ + GetName(2)
Location3: ‘1,5,’ + GetName(3)
Location4: ‘1,5,’ + GetName(4)


when i run the table it can only displayed A1,C3,C3,C3 in the captions