Courtesy : DUG
It's very simple to pass value from a form to a class by defining a method on form and using args.caller() in the class.
1. Take a String control in the form design like string Customer Name.
2. Go to String control properties and set "Auto declaration" property to "Yes".
3. Go to form methods -> new method -> write return type method like;
public str customerName()
{
return CustomerName.Text();
}
4. Go to main() method of the class and type following:
public static void main(Args args)
{
str custName;
;
if(formHasMethod(args.caller(), identifierStr(customerName)))
{
custName = args.caller().customerName();
}
info(strFmt("%1", custName));
}
5. Open form enter some text into text box and call this class through menuItem button. It will display the entered text in the info log.
6. Likewise, write code for each and every control.
Dynamics User Group
It's very simple to pass value from a form to a class by defining a method on form and using args.caller() in the class.
1. Take a String control in the form design like string Customer Name.
2. Go to String control properties and set "Auto declaration" property to "Yes".
3. Go to form methods -> new method -> write return type method like;
public str customerName()
{
return CustomerName.Text();
}
4. Go to main() method of the class and type following:
public static void main(Args args)
{
str custName;
;
if(formHasMethod(args.caller(), identifierStr(customerName)))
{
custName = args.caller().customerName();
}
info(strFmt("%1", custName));
}
5. Open form enter some text into text box and call this class through menuItem button. It will display the entered text in the info log.
6. Likewise, write code for each and every control.
Comments
Post a Comment