Home Forums WinForms controls Xceed Grid for WinForms How to get cell value from selected row

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

    In the SelectedRowsChanged event, how to get the value of
    a selected row’s cell by column name

     

    I’m expecting something like

     

    gridControl1.SelectedRows[0].Cells[<field name>].value

     

    but Cells collection doesn’t exist in this context….

     

    Thanks

    Imported from legacy forums. Posted by Frederic (had 2183 views)

    User (Old forums)
    Member
    Post count: 23064

    Found the solution but it’s ULTRA COUNTER INTUITIVE: you need to cast the collection of  Xceed.Grid.Row selectedRows property output by a – most likeley – inherited class CellRow. Thus, answer is:

    (Xceed.Grid.CellRow)gridControl1.SelectedRows[0].Cells[<field name>].Value

    Imported from legacy forums. Posted by Frederic (had 476 views)

    User (Old forums)
    Member
    Post count: 23064

    Frederic, I am in similar situation where I have to get cell value from row, using QTP.

    Thank you for you reply, but I am not  under “you need to cast the collection of  Xceed.Grid.Row selectedRows property output by a – most likeley – inherited class CellRow.”

     In my case what is “gridcontrol1”?

    if I execute below code, I get number of rows
    Set x = SwfWindow(“FormName”).SwfObject(“grid”).Object.DataRows
    y = x.Count
    MsgBox y

    if I execute below code,
    Set t = SwfWindow(“FormName”).SwfObject(“grid”).Object.DataRows(0).
    no options are displayed by QTP.
    When I type “.” QTP gives some options, example “SwfWindow(“FormName”).SwfObject(“grid”).Object.DataRows.” QTP displayes count etc options and I can select, but when I type
    “Set t = SwfWindow(“FormName”).SwfObject(“grid”).Object.DataRows(0).” no options are displayed

    Can you please help me?

    Imported from legacy forums. Posted by steve (had 1250 views)

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