cancel
Showing results for 
Search instead for 
Did you mean: 

How to get ComboBox selected value text from SAP B1 form

werneriten
Explorer
0 Kudos

How do I get a combobox selected value ?

In the attached screen shot , Payment Terms drop down list i have chosen "30 Days EOM" value .

Using c# code, how can get ComboBox(dropdown) selected value.

This is my sample code for getting text box values, same way how to get drop down selected text.

Thanks.

SAPbouiCOM.EditText oEdit = null;
 SAPbouiCOM.Item oItem = null;
oItem = oForm.Items.Item("234000013");
                oEdit = ((SAPbouiCOM.EditText)(oItem.Specific));
                primaryPartyCode = (oEdit.String);

View Entire Topic
former_member185682
Active Contributor

Hi Werner,

Use something like this:

SAPbouiCOM.ComboBox cbx = (SAPbouiCOM.ComboBox)oForm.Items.Item("your id").Specific;
if (cbx.Selected != null)
{
    string descrition = cbx.Selected.Description;
    string value = cbx.Selected.Value;
}

Hope it helps.

Kind Regards,

Diego Lother

werneriten
Explorer

Hi Diego,

Your mention code working very fine.

Thank you your prompt replay Diego Lother.

werneriten
Explorer
0 Kudos

Hi Diego,

Can you please provide me same as Check box, Radio button selected values related code.

I mean (Active,Inactive) or (Paid ,Unpaid) Radio button,Check box .

same as if check box items.

thanks.

former_member185682
Active Contributor
0 Kudos

Hi Werner,

For check box:

SAPbouiCOM.CheckBox chk = (SAPbouiCOM.CheckBox)oForm.Items.Item("your item id").Specific
bool isChecked = chk.Checked;

For option button:

SAPbouiCOM.OptionBtn optb = (SAPbouiCOM.OptionBtn)oForm.Items.Item("your item id").Specific
bool selected = optb.Selected;

Hope it helps.

Kind Regards,

Diego Lother

werneriten
Explorer
0 Kudos

Hello Diego Lother,

Above sample code working very fine.

Thank you your prompt replay Diego Lother.

Thanks,

Former Member
0 Kudos

Dears Dlego Lother.

I added a UDF COMBOX control in the standard SO LINE MATRIX UI. I want to assign value to UDF COMBOX control, but the COMBOX of VALUE in SDK is read-only. What should I do? thanks.