12 October 2011

Pass The Parameters to Class

To pass the parameter from the form selected record to class
1.Create a class as following code.
2.Add this class to Actions MenuItem.
3.In form add this MenuItemButton.
Open the form Select a record in the grid and click the button.
That record passed to the Main method. in info you will Vendor id get 2 times.
Cause New Method is calling and Post method is calling.

public class EmplProcess
{
VendTable _VendTable;
}
-
public void new(Common vTable)
{
_VendTable = vTable;
this.post();
}
-
public void post()
{
info(_VendTable.AccountNum);
}
-
public static void main(Args args)
{
Common _common;
EmplProcess _EmplProcess;

_common = args.record(); //getting the record from the form
_EmplProcess = new EmplProcess(_common);//passing the above record to the new method
_EmplProcess.post();// calling the post method
}
__________________________________________________________________________________--


While creating Object for class we can pass the parameter.
ex:

Class1 cls;
;
cls = new Class(VendTable);// this is Data Source name in Vend Table form

//in class override the new method and assign the Parameter.
public void new(VendTable vTable)
{
_VendTable = vTable;
}

1 comment:

  1. Where u write Clicked method
    Please write a post proper way, it is much confusing man.

    ReplyDelete

Give me the commetns and solutions

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension->...