Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Example: TcxCustomDataController.SaveToStream, TcxCustomDataController.LoadFromStream

The SaveToStream and LoadFromStream methods provided by a data controller enable you to save and restore data in unbound loading mode.

The following example shows how to save information and restore it from a file for the tvPlanets view in ExpressQuantumGrid.

var
  AStream: TStream;
//...
//Saving data to a file
  AStream := TFileStream.Create('e:\stream.txt', fmCreate);
  try
    tvPlanets.DataController.SaveToStream(AStream);
  finally
    AStream.Free;
  end;
//...
//Loading data from the file
  AStream := TFileStream.Create('e:\stream.txt', fmOpenRead);
  try
    tvPlanets.DataController.LoadFromStream(AStream);
  finally
    AStream.Free;
  end;