HOW TO GET SELECTED VALUE FROM DROPDOWN AND USE IN SWITCH CASE

HI,

I AM HAVING A DROPDOWN CONTROL. I WANT TO GET THE SELECTED VALUE FROM DROPDOWN CONTROL INTO A VARIABLE AND THEN USE THAT VARIABLE IN SWITCH CASE AND PERFORM TEH REQUIRED ACTIONS. I AM NOT ABLE TO GET THE CONTROL NAME ON THE FORM AND SO WHEN CONTROL NAME IS WRITTEN ON TEH CLICK EVENT OF THE BUTTON ITS SHOWING ERROR AS VARIABLE NOT DEFINED.

CAN ANY ONE PLS HELP ME AS HOW CAN I GET THE SELECTED VALUE FROM DROPDOWN LIST INTO A STRING VARIABLE AND THEN USE IT IN SWTCH CASE.

THANKS IN ADVANCE FOR YOUR HELP.

HIMANSHU.

Hi,

To solve your problem of indefined variable, you just have to set the autoDeclaration property of your control to yes,

then you’ll be able to have the selected value from your control with a syntax like yourControl.value() or your control.text() something like that,

to test the selected value, add a modified() method on your control or on the form datasource field corresponding to your control

let me know if it works for you, you can mail me if you have problems

Regards,

Thomas

Hi Himanshu,

Please dont write in all caps. It is considered shouting / yelling and not good etiquette.

hello,

sorry for next time i will make sure i write things in small letters and not in caps.

himanshu

hi,

Thanks for your immedite help. I did auto declaration = yes but still in the form i m not able to get the Control name . When ever i write the control name it shows error like variable not declared and due to this i m not able get .selected or .text options

himanshu

Hi,

may be I didn’t correctly understand your problem, to get your control name, set autodeclaration = yes and use the following code yourControlName.name(), returns a string with the value of the name property of your control.

if I do InventJournalTrans_ItemId.text() or .valueStr() gives me the content I modified

I’m afraid I don’t understand correctly your problem, but if you want to access properties of controls, you don’t have choice, it’s autodeclaration = yes, to get the value of your control it depends on the dataType behind your control, mostly it’s yourControlName.text() or value() or valuestr()

Could you explain exactly what you want? which datatype is behind your combo(enum, real, int, str etc), which kind of control is your combo (stringEdit, realEdit, comboBox etc…)

Regards,

Thomas