cancel
Showing results for 
Search instead for 
Did you mean: 

Combobox

Former Member
0 Kudos
106

Hi,

when am using this code to populate my combobox

oDbds = oForm.DataSources.DBDataSources.Add("OITM")

oDbds.Query()

For i = 0 To oDbds.Size - 1

ocombo.ValidValues.Add(oDbds.GetValue("ItemCode"), i)

Next

the following error is promted..

Argument not specified for parameter Description of Public Function Add(value as String,Description as String) as sapbouiCom.ValidValue.

can someone help me to sort this out.

thanks

Mini

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member192187
Participant
0 Kudos

Hey Mini

Try this:

For i = 0 To n - 1

                s = DBDS1.GetValue(0, i).ToString
                ss = CInt(s)
Next i

0 should be the nr a column

Hope this helps

Krzysztof Sala

Former Member
0 Kudos

Hi Mini,

What I do see in your code is that method GetValue should get 2 parameters instead of 1, and the second parameter for Add, i is a number, and the method should get a string. So if you use i.ToString() instead of i, I think it should work.

On the other hand, if what you want to do is to show all the values from the OITM in the combobox, you could use the DBDataSource directly. Have a look here, topic "Bind DBDataSource to ComboBox":

/people/ibai.pea/blog/2006/07/26/sbo-faq

Hope helps,

Ibai Peña

Message was edited by: Ibai Peña

Former Member
0 Kudos

Hi Ibai,

Thanks for replying

Actually i tried using .tostring() along with i but that didnt help me out.

Now i have bounded the combobox with database but my drop down list does not work there and moreover i have to refine my select query based on a condition to.

CAn you help me in resolving it...

Thank you

Mini

Former Member
0 Kudos

Hi,

Could you post the code?

For the condition, you should use the DoQuery methods "Condition" optional parameter. Have a look at the UI API for more information about it.

Regards,

Ibai Peñ

former_member192187
Participant
0 Kudos

Ahh.. Mini, look on Your loop, i parameter should be description, try change i to string, because Add method required fields Add(string, string).

regards

Krzysztof Sala