Home Forums WinForms controls Xceed Grid for WinForms How can I get the display member of the combo?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #13309 |

    I have a combobox in a column in the grid:
    Following is the code for that:
    ‘defining the cell as combobox
    Dim editor As New Xceed.Grid.Editors.GridComboBox()
    editor.DataSource = sqlDS.Tables(“result”)
    editor.DisplayMember = “description”
    editor.ValueMember = “code”
    grdGRV.Columns(“desc”).CellEditor = editor

    I am able able to get the value member of the combo as follows?
    MsgBox(row.Cells(“desc”).Value())

    How can I get the display member of the combo?

    I want to know the display member and display value.

    Imported from legacy forums. Posted by PETE (had 1975 views)

    User (Old forums)
    Member
    Post count: 23064

    I think you’ll have to manually look up the display that comes with the value. First you get the value (row.Cells(“desc”).Value()), then you loop through the datasource of the combobox.

    I’m a C# programmer, and I see you need a VB.NET solution. So, I’ll give you some pseudocode (please convert to prefered language):
    <code>
    object value = row.Cells(“desc”).Value()
    object display = null
    foreach DataRow row in sqlDS.Tables(“result”).Rows do
    if object.Equals(value, row.Item(“code”)) then
    display = row.Item(“description”)
    break
    end if
    end for
    </code>

    Imported from legacy forums. Posted by Tommy (had 2985 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.