Search code examples
axaptamicrosoft-dynamicsdynamics-ax-2012x++dynamics-ax-2009

Correct form to pass value to IntEdit and StringEdit from a method dynamics ax


I dont know what is the correct form to pass values from method to the fields, I already put yes on autodeclarate and check if the value I send from the method match with the type of field, I dont have any error only doesn't work. In fact it works with the IntEdit but for example when I send 500 shows me 1 I dont hunderstand why

This is my code

private void method1(){
   int var = 500;
   Field.value(var); }

And I would like to know how to pass that values from the method to StaticText.


Solution

  • To set value of StaticText control in form you should use text() method of StaticText

    For example

    My StaticText is called ST1 (Autodeclaration = Yes).

    ST1.text("Some value");
    

    If you need a method to return a value for StaticText try this:

    public str setStaticText()
    {
        int var = 500;
        return int2str(var);
    }
    

    Then in init method of form for example

    public void int()
    {
        super();
    
        ST1.text(this.setStaticext());
    }