Skip to Content
0
Former Member
Apr 24, 2011 at 08:30 AM

Event et_CHOOSE_FROM_LIST can not get selected value to EditBox

39 Views

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>