Dynamic field length in a dialog

I have a field in a dialog which takes personal messages from the customer. But the catch is, the length of the field is decided by a column in the invent table called Char_count. So if the char_count is 12, the field in the dialog should take only 12 chars of message. I gave a max limit of 24 to the field, so every time i open the dialog, it gives a text box of 24 characters length. But I need the text box which allows only the number of characters equal to the Char_count. What do I do about this?

Hi Lohit,

you can use the method limitText(), for example

Dialog      dialog;
DialogField field;
field = dialog.addField(fieldStr(CustTable, AccountNum));

Yup. Works Perfectly. Thanks a lot.