cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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")

Accepted Solutions (0)

Answers (1)

Answers (1)

bruno_peyron
Active Participant
0 Kudos

Hi

I think you code is not good

Try

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

Former Member
0 Kudos

hi...it was working fine...when the form is in find mode..i want the default value to be added to my combo box when i change form mode to add mode....