Search code examples
c++c++buildervcltstringgrid

C++ builder TstringGrid get string from specific cell


Hello everybody i have C++ tStringGrid

I want to get string from specific cell with coordinates

I have tried this but without luck:

UnicodeString cell_obj = StringGrid1->Objects[3][2]->ToString();

Error:

Access violation at address 00407617 in module 'NGG_Client.exe'. Read of address 00000000.

Please help.


Solution

  • I don't have a working dev enviroment up that can build this but try:

    assert( StringGrid1->ColCount > 3 && StringGrid1->RowCount > 2 );
    UnicodeString cell_str = StringGrid1->Cells[3][2];
    

    It might be an AnsiString instead of a UnicodeString.