controlling form tabs using variables

Hi, i’m new to Axapta and got a problem that is driving me nuts. I’ve created a form, with tabs, five tabpages and a button. I want to change the caption of the selected tab when the button is clicked. This is what i’ve got so far: tab1:pageActivated public void pageActivated() { super(); setActiveTAB = this.name(); } button:clicked void clicked() { super(); setActiveTAB.caption(“current”); } I already figured out i cannot use the str setActiveTAB as a control. But I do not know how to change the variable into something that actually calls the tabpage. Hope you can help me!

Hi mbt, You may change your code a litle like this: button:clicked void clicked() { FormTabPageControl ctrl; super(); //setActiveTAB.caption(“current”); ctrtl = element.design().controlName(“setActiveTAB”); ctrl.caption = “ABC”; } Hope this help

Dear Khue Trinh, Thank you for a swift reply! Although your solution has helped me gain more insight into Axapta programming, it did not solve my problem. Please allow me to explain: The code you’ve supplied gives the following error: The table is out of range or does not exist. void clicked() { FormTabPageControl ctrl; super(); //setActiveTAB.caption(“current”); ctrl = element.design().controlName(“setActiveTAB”); ctrl.caption = “ABC”; } I am confused about the error, does this mean the variable ctrl doesn’t exist and cannot be used for some reason? When i change ctrl.caption = “ABC”; to ctrl.caption(“ABC”); and run the form, the following error occurs: Error executing code: FormTabPageControl object not initialized Let me know what my mistake is, thank you in advance.

sorry friend, Last time I didn’t have Axapta instalation on the computer, so the code is not correct. Please find the attched file and import to your Axapta as an example. This form I made is not perfect, but it will help you for sure. Regards,
Attachment: MultiTabPage.zip ( 1331bytes )

Hi Khue,

I have used the DSN using the LoginProperty class to access the DB outside of AX DB. And implement this into a Class.

Now I am using this class method in my form’s data source method named “write”. But it gives me the error “The table is out of range or does not exist.”.

Can you please help to figure it out.

Its urgent.

Thanks,

Ashlesh

Hi Mbt,

need only clicked method pls delete your own pageactivated method.

button:clicked
void clicked()
{

FormTabPageControl ctrPage;

super();
ctrPage= tab1. controlNum(tab1.tab());

ctrPage.caption(“current”);
}

regards