Thursday, March 31, 2011

How to add methods to Forms

How to add methods to forms in Axapta?
Here i will show you how to get data from a particular field. Let us suppose that the new text box that you have created is intEdit which is a integer type text box in Morphx and on clicking of a button you want to get the data from a field then. Override the click method of a button and write in there.

intEdit.valuestr();

This line will capture the value of the text box intEdit.

Now, i will show you how to send a text to a form. Suppose you have a textBox of integer type intEdit and you need to send the data to that box using a button then, override the click method of the button and put in there.

intEdit.text(str2int("Hello"));

This will first convert the string to integer value and then send the data to the text box of integer type.

Note: Dont forget to change the Autodeclaration Property of the control to YES