// saving runtime state ecMemoStateStorage.Assign(SyntaxMemo1); ... // restoring runtime state SyntaxMemo1.Assign(ecMemoStateStorage)