Business Central Run Time Version issue

Hello All,

I want to make "Invoice Discount Amount" field(actually its variable control) from Sales Invoice Subform un editable. for that I wrote following code and getting error.

Then I changed Runtime Version to 2.2, then I am getting following error.

I want to do this on On Prem as well as Cloud Version. Above scenario is On Prem version.

My VS Code is updated if I check for updates.

What can I do in this case?

Thanks in advance.