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;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: