Passing argument from Form to Class in Ax 2012

FORM

form2class

void clicked()

{
Form2ClassJk f2c;

super();

f2c=new Form2ClassJk();
f2c.GetInt(intCont.value());
f2c.GetStr(StringCont.valueStr());

}

CLASS

class Form2ClassJk
{

}

public void GetInt(int a)
{
info(strFmt(“%1”,a));
}

public void GetStr(str s)
{
info(strFmt(“%1″,s));
}

Static void main(Args args)
{
str fullname;
container con;

fullname=args().parm();

con = str2con(fullname,”-“);
NumCont.value(conPeek(con,1));
NameCont.text(conPeek(con,2));
}

Passing argument from Class to Form in Ax 2012

CLASS

class2form

 

FORM

public void init()
{
str fullname;
container con;

super();

fullname=element.args().parm();

con = str2con(fullname,”-“);
NumCont.value(conPeek(con,1));
NameCont.text(conPeek(con,2));
}

CLASS

class Class2Form
{
int a,b;
str s;
}

Public int GetIntvalue()
{
a=10;
return a;
}

Public str GetStrValue()
{
s=”Johnkrish”;
return s;
}

Static void main(Args args)
{
str fullname;
//Args args;
container con;
FormRun formRun;
Class2Form co;

co=new Class2Form();
args=new Args();
con=conIns(con,1,co.GetIntvalue());
con=conIns(con,2,co.GetStrValue());

fullname=con2Str(con,”-“);
args.parm(fullname);
args.name(“Class2Form”);
formRun = classFactory.formRunClass( Args );
formRun.init();
formrun.run();
formrun.wait();
}