Forum Discussion

NicoH's avatar
NicoH
Frequent Visitor
3 years ago

Delphi: Retrieve Cell Values from TStringgrind descended

Hello we're using Delphi 11 and are having following problem:
As mentionend in the subject we're using a TStringGrid descended.
We were able to get access to a specific cell but the method Grid.Cells (ACol, ARow) does not return a text value.

 

We tried to work with the Code from the sample Documentation(See the attachment).

 

Thanks in advance.

1 Reply

  • Hi NicoH,

     

    I am not 100% certain about your grid control's properties, but a lot of cell objects will have a Value property that you can access.  So, your code might work if you add the Value property, like this:

     

         Log.Message ("Cell (0, " + Col + ") value: " + Grid.Cells(0,0).Value.asString);

     

    If the Value property returns an index or an Id that maps to the displayed value (if the cell uses a drop down list to set the value, for example) , then you might need to use the FormattedValue property, like this:

     

         Log.Message ("Cell (0, " + Col + ") value: " + Grid.Cells(0,0).FormattedValue.asString);

     

     

    I hope this helps.

     

    Regards,