Both of your explaination helped me to found a solution to my problem. The only thing that was missing is because I wanted to use that value in the the form called. It's because I didn't think that the class was created in the report. Stupid error from me. But I wasn't sure if how work classes with contruct and main anyway, so it helped me a lot.


Thanks!



----- Original Message -----

From: Bjørn Gudbrand Idstad To: [EMAIL PROTECTED] Sent: Tuesday, November 04, 2003 3:30 AM
Subject: RE: [development-axapta] Problem with args's class


Hi!

You can't access variables declared in classDeclaration in static-methods, i.e 
construct and main.
In a static method you need to create an instance of the class that you want to use, 
and then use that classes methods.
If you wabt to use variables from e.g a form, these variables has to be passed to the 
class.

An example:

You have a class CustUpdate, with a classdeclaration, a main(Args _args)- method and a updateCustomer(CustAccount _custAccount)-method.

The class is supposed to update a customer where custAccount equals the value passed from the args-object

If you run this from a menuitem, the main-method is executed:

static void main(Args _args)
{
CustUpdate custUpdate = new CustUpdate(); // Create instance
CustAccount custAccount;
;
if (custUpdate && _args.parm())
{
custAccount = args.parm();
custUpdate.updateCustomer(custAccount);
}
}


void updateCustomer(CustAccount _custAccount)
{
CustTable custTable;
;
ttsbegin; if (custAccount)
{
custTable = CustTable::find(custAccount, true);
custTable.Name = "New name"; // Update something
custTable.update();
}
ttscommit;
}





-----Original Message-----
From: johnn_16 [mailto:[EMAIL PROTECTED] Sent: Monday, November 03, 2003 10:18 PM
To: [EMAIL PROTECTED]
Subject: [development-axapta] Problem with args's class



Hi, I would like to pass value from one form to another. Unfortunatly, the value must pass trought classes because the called form is called with a menuItem-->Action. When I pass the value with the args.parm() of the menuItem to the class, I lost the value. I can access it in the construct and main method of the class, but after that, I lost it. Also, in the Construct and Main method, I can't access variables in the classDeclaration neither the other method of the class.


Can anyone can explain me why? Help is greatly needed here and if you don't understand what I want, please ask me to re-explain.

Thanks!



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.




Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.




Yahoo! Groups Sponsor ADVERTISEMENT
click here


Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

Reply via email to