cancel
Showing results for 
Search instead for 
Did you mean: 

Event et_CHOOSE_FROM_LIST can not get selected value to EditBox

Former Member
0 Kudos

Hi, Expert,

pls help to review my code and tell me what's wrong...


    class B1AddOn01EventHandler : B1WizardBase.B1Event
    {
        [B1Listener(BoEventTypes.et_CHOOSE_FROM_LIST, false)]
        public virtual void OnAfterChooseFromList(ItemEvent pVal)
        {
            SAPbouiCOM.Form oForm = null;
            SAPbouiCOM.IChooseFromListEvent oCflEvent = null;
            SAPbouiCOM.DataTable oDataTable = null;

            if (pVal.ItemUID.Equals("tbxVendor"))
            {
                oForm = B1WizardBase.B1Connections.theAppl.Forms.Item(pVal.FormUID);
                SAPbouiCOM.EditText oTbxVendor = (SAPbouiCOM.EditText)oForm.Items.Item("tbxVendor").Specific;
                oCflEvent = (SAPbouiCOM.IChooseFromListEvent)pVal;
                oDataTable = oCflEvent.SelectedObjects;
                oForm.DataSources.UserDataSources.Item("dsVendor").ValueEx = oDataTable.GetValue(0, 0).ToString();
            }
        }
    }

My From XML file:


<userdatasources>
    <action type="add">
        <datasource size="10" type="9" uid="dsVendor" /> 
    </action>
    <action type="add">
        <datasource size="" type="10" uid="dsDtFrm" /> 
    </action>
    <action type="add">
        <datasource size="" type="10" uid="dsDtTo" /> 
    </action>
</userdatasources>


<item uid="tbxVendor" type="16" left="420" tab_order="0" width="80" top="10" height="14" visible="1" enabled="1" from_pane="0" to_pane="0" disp_desc="0" right_just="0" description="" linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1" supp_zeros="0" AffectsFormMode="1">
  <AutoManagedAttribute />
  <specific TabOrder="0" ChooseFromListUID="CFL_2" ChooseFromListAlias="CardCode">
    <databind databound="1" table="OCRD" alias="dsVendor" />
  </specific>
</item>


<ChooseFromListCollection>
  <action type="add">
    <ChooseFromList UniqueID="-1" ObjectType="-1" MultiSelection="0" IsSystem="1" />
    <ChooseFromList UniqueID="CFL_2" ObjectType="2" MultiSelection="0" IsSystem="0">
      <conditions>
        <condition bracket_open_num="0" bracket_close_num="0" cond_end_val="" cond_value="S" operation="1" relationship="0" compare_fields="0" alias="CardType" compared_field_alias="" />
      </conditions>
    </ChooseFromList>
  </action>
</ChooseFromListCollection>

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member689126
Active Contributor
0 Kudos

Hi

If you are binding your edit text with a userdatasource then no need to specify the table name

<item uid="tbxVendor" type="16" left="420" tab_order="0" width="80" top="10" height="14" visible="1" enabled="1" from_pane="0" to_pane="0" disp_desc="0" right_just="0" description="" linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1" supp_zeros="0" AffectsFormMode="1">
  <AutoManagedAttribute />
  <specific TabOrder="0" ChooseFromListUID="CFL_2" ChooseFromListAlias="CardCode">
    <databind databound="1" table="" alias="dsVendor" />
  </specific>
</item>

Regards

Arun

Former Member
0 Kudos

It works. thank you!