Saturday, 25 April 2015

How to Get Text from String Edit Control in Form Microsoft Dynamics AX 2012 R3

I am a newbie in AX.. ^^ I have a difficult time to search article that show a way to get text from string edit control in form AX 2012 R3. Thank God, I finally found a solution. Hope this tutorial is helpful to you (^o^)/

1. We need to add string edit control in our form
a. In your form, right click on Design > New Control > Tab
b. To make your tab is autosize, change width to Column Width and height to Column Height
c. Right click on Tab > New Control > TabPage
d. Right click on TabPage > New Control > StringEdit

2. Change Property of StringEdit 
a. Name : TxtMyString
b. Auto Declaration : Yes (to make your control is available in your X++ code
c. Width : Column Width (set autosize of StringEdit)
d. Label : My String (set caption of StringEdit)
e. ExtendedDataType : ItemFreeTxt

3. Add method in StringEdit to get text when StringEdit is modified.
a. Expand StringEdit:TxtMyString
b. Right click on Method > Override method > modified 

4. Add x++ code like below to get text from StringEdit control
a. Add "info(TxtMyString.text());"
b. Click Compile and Save (make sure there is no error - red underline)

Voila... Now we get text from our TxtMyString ^^ Super easy right?

No comments:

Post a Comment