Forum Discussion

Dio's avatar
Dio
Visitor
9 years ago

how can it get the value of a cell in a datagrid control?

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    First of all, welcome to the community! Congrats on your first post.

    As for getting values from a datagrid, since I'm not certain what type of datagrid you're using (since there are several), the best thing I can do is point you to the documentation online.  SmartBear has an extensive topic on datagrids at https://support.smartbear.com/viewarticle/75394/

    Now, for your specifics, basically you just need to know the cell row and column and you can get the value from it.  There is a topic specifically for that at https://support.smartbear.com/viewarticle/71249/#Get but in general pseudo code it would look like

     

    CellValue = MyApp.Datagrid.wValue(2,4)

    This will return whatever the contents are in row 2, column for of the indicated data grid.

     

    Hope this helps!

    • Colin_McCrae's avatar
      Colin_McCrae
      Community Hero

      As above, we need to know what type of datagrid.

       

      Some of the Delphi ones I use have an underlying recordset object that contain the values presented in the cells of the grid. Simple wValue queries don't work on these, you have to go digging about in the recordset object. And the co-ordinates within the grid can seem unusual if you have hidden rows and columns. (ie. Not visible/present on the UI grid, but still present in the underlying dataset behind it .... onscreen toggles etc may trigger them becoming visible in the UI)

       

      (Being Delphi - these also need debug data enabled or none of the recordset methods and properties are available to me ...)

       

      So need more info.