Lazarus

Programming => General => Topic started by: cdbc on July 02, 2020, 12:05:59 pm

Title: TmemoryStream...
Post by: cdbc on July 02, 2020, 12:05:59 pm
Hi
Right, so i've got this form, collecting data from user and populates a business object. One of the members is a TMemoryStream, that loads a file, all fine and dandy, but what happens when the user cancel in the midst?!? In short, i need to get rid of the data already loaded in the memorystream. Would this be a viable solution:
Code: Pascal  [Select][+][-]
  1. procedure TfrmEditBlob.btnCancelClick(Sender: TObject);
  2. begin
  3.   TMemoryStream(fBlob.Blob).SetSize(0);              // delete blob contents
  4.   fBlob.Blob.Position:= 0;
  5.   Close; // just forget everything
  6. end;
TIA - Benny
Title: Re: TmemoryStream...
Post by: jamie on July 02, 2020, 12:14:23 pm
Memorystream.Clear

that keeps it alive still but empties it ..
TinyPortal © 2005-2018