Skip to Content

Get the selected item from a combo box

Hi, everybody

I have created a grid in a folder.

One column of the grid is called TransferTo. I made this column into a column of combo boxes.

The combo box works well, but when I select an item, it does not go into the TransferTo field on the grid.

Please help me write the correct code.

How to bind?

Thanks

Leon Lai

--------------------

My relevant code is as below:

'==============================================

'//INSERT CHECKBOX IN COLUMN

'==============================================

oGrid.Columns.Item("TransferTo").Type = SAPbouiCOM.BoGridColumnType.gct_ComboBox

Dim oCombo As SAPbouiCOM.ComboBoxColumn

oCombo = oGrid.Columns.Item("TransferTo")

Dim oRecordSet As SAPbobsCOM.Recordset

Dim StrQuery As String

oRecordSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

StrQuery = "Select T0.CardCode,T0.CardName FROM OCRD T0 ORDER BY T0.CardCode "

oRecordSet.DoQuery(StrQuery)

oRecordSet.MoveFirst()

While Not oRecordSet.EoF

oCombo.ValidValues.Add(oRecordSet.Fields.Item("CardCode").Value.ToString, oRecordSet.Fields.Item("CardName").Value.ToString)

oRecordSet.MoveNext()

End While

Capture.JPG (172.8 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Mar 05, 2015 at 11:20 AM

    Hi Leon,

    Use the DataTable property on your grid to set the value.

    oGrid.DataTable.SetValue("columnId", row, value);


    Best regards,

    Pedro Magueija


    View Pedro Magueija's profile on LinkedIn

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 05, 2015 at 11:21 AM

    Hi Leon,

    Ps: The code you showed will only populate the "available values" of the combobox.


    Best regards,

    Pedro Magueija


    View Pedro Magueija's profile on LinkedIn

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.