While the code kindly supplied by Shruti will work, I would recommend
using the MenuFunction call instead.
Ie
Args Args = new Args();
MenuFunction MenuFunction;
;
MenuFunction = new MenuFunction(MenuItemDisplayStr(....),
MenuItemType:: ....);
Args.Record( ...);
MenuFunction.Run(Args);
I will you to fill in the blanks (hint, look at Shruti's code).
There are several reasons for this:
1. You can easily change the referenced form without having to modify
code.
2. Security. The formRun method (as shown) does not use security Key
information. Security information is placed on menu items, not the
objects they reference.
Barry.
-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Shruti
Sent: Tuesday, 20 December 2005 3:38 PM
To: [email protected]
Subject: Re: [development-axapta] Opening a form
Hi Manoj,
Below is the code for three type of combo values : Asset, Ledger &
Vendor.
Just write the code below on the clicked method of the button thru which
u
need to open the form.
*LedgerVendAsset_Combo is the name of the combo field
*LedgerVendAsset is the name of the Base enum
*account is the name of the field where the lookup of the account number
is
displayed
void clicked()
{
AssetTable assetTable;
LedgerTable ledgerTable;
VendTable vendTable;
FormRun formRun;
Args args = new Args();
;
super();
switch(LedgerVendAsset_Combo.valueStr())
{
case enum2str(LedgerVendAsset::Asset):
assetTable = AssetTable::find(account.valueStr());
args.record(assetTable);
args.name(formstr(AssetTable));
break;
case enum2str(LedgerVendAsset::Ledger):
ledgerTable = LedgerTable::find(account.valueStr());
args.record(LedgerTable);
args.name(formstr(LedgerTable));
break;
case enum2str(LedgerVendAsset::Vendor):
vendTable = VendTable::find(account.valueStr());
args.record(vendTable);
args.name(formstr(VendTable));
break;
default:
break;
}
formRun = ClassFactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
}
----- Original Message -----
From: "manojkumar_asp" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, December 19, 2005 6:49 PM
Subject: [development-axapta] Opening a form
> Hi All,
> I have created a form where there are different accounts for
> ledger,Fixed assets, vendor,Cost accounting listed in combo box.When i
> select a account type and click the lookup form the account number and
> name is displayed, Now i want to add a button next to the form and
> when selecting the particular account number from lookup and pressing
> the button should open the ledger form or vendor form or etc with only
> the account number i selected or can display all the value but the
> selected account number highlighted. Please give me any solutions.
> Thanks in advance.
>
> Regards,
> Manoj
>
>
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
Yahoo! Groups Links
SPONSORED LINKS
| Computer part | Programming languages | Microsoft axapta |
| Support exchange |
YAHOO! GROUPS LINKS
- Visit your group "development-axapta" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

