passing container from one form to another form

Hi,

I got to know that, to pass a container from one form to another form, we have to convert it to string and then pass it to other form. In the second form, we need to catch that string with ‘element.args().parm()’ and then convert it back to container using str2con method.

Can we directly pass the container between the forms without these conversions??

Thanks in advance.

It’s much better to use a little bit of object-oriented programming and call a method returning the container. You can either pass an object as parameter (Args.parmObject()) or calling a method of the calling form (Args.caller()).

Hi Martin,

How does args().caller() works in this case.

I wrote a method(conret) in calling form to return the container with the values and called it by using

con = args().caller().conret();

But, it is not working and trying an error that it is a syntax error;

If I am going wrong some where please correct me.

Thanks.

And what is args()? AX doesn’t contain any global function of that name, therefore trying to use it causes a syntax error. You have to specify the object that has the method you want to call - this.args() or element.args().

I have even tried element.args().caller().conret();

But, I am getting

Object object not initialized.

Stack trace

(C)\Reports\V_EnquiryForm2\Methods\init - line 14

(C)\Classes\xMenuFunction\run

(C)\Classes\MenuFunction\run - line 85

(C)\Forms\V_EnquiryForm\Designs\DesignList\PrintAgain\Methods\Clicked - line 20

But that’s a completely different error.

It means that you’re trying to call a method on a null object. You probably don’t send any caller object in Args.