Skip to Content
0
Former Member
Dec 01, 2009 at 10:37 AM

how to add default values to combobox when form is in Add mode

21 Views

hi..

i have created a form where i have a combobox...i have some values for combobox called (open, closed, sold) when form loads for the first time and when it is in Add mode then the default value should be OPEN in combo box..

i tried this code...this code is working fine when form is in find mode...when when the form mode is changed to add mode...there is no value selected in combo box...what should i do to have default value as OPEN in my combo box in ADD mode????

oForm.DataSources.UserDataSources.Add("ComboSrc5", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1)

        oitem = oForm.Items.Item("21")  ''for accessing the combo box item
        oCombo = oitem.Specific

        '' to bind the combo box item to defined user data source
        oCombo.DataBind.SetBound(True, "", "ComboSrc5")

        ''giving some static values to combobox
        oCombo.ValidValues.Add("OPEN", "1")
        oCombo.ValidValues.Add("CLOSED", "2")
        oCombo.ValidValues.Add("SOLD", "3")

        oCombo.Select("OPEN", SAPbouiCOM.BoSearchKey.psk_ByDescription)

        oForm.Items.Item("21").Specific.DataBInd.SetBound(True, "@FA_MASTERDATA", "U_Asset_Status")