The cxGrid is just a container for ChartViews, TableViews, CardViews and BandedTableViews. Being a container, it does not know anything about rows and columns. Because you want to replace a StringGrid I suggest using a (non-DB) TableView.
To get a TableView...
- ...open the grid customization form (click on "Customize..." in the grid's "Structure Navigator" in the form designer).
- Go to the "Views" tab and click "Add View...". Choose "Table" (not "DB Table"!).
- On the "Structure" tab right-click on the cxGrid1Level1 symbol, choose "Select View" and the new TableView.
- You can now go back to the "Views" tab and delete the DB TableView (cxGrid1DBTableView1).
(See also the DX help topic "Grid Levels" unter the heading "Specifying Associated Grid Views".)
Instead of "RowCount" you would then use YourView.DataController.RecordCount
. "ColCount" would be YourView.ColumnCount
. You can access cell values with YourView.DataController.Values[...]
. To speed up the populating the view I'd surround it with
YourView.DataController.BeginUpdate;
try
YourView.DataController.RecordCount := x;
// ...
finally
YourView.DataController.EndUpdate;
end;