LAN Web TCP Delphi

Title: How to preview HTML Quellcode in TWebbrowser?
Question: How to preview Quellcode from a Memo in to a TWebbrowser?
Answer:
You need a Memo, Button and a TWebbrowser
uses ActiveX;
The Button Click Event:
...
var
sl: TStringList;
ms: TMemoryStream;
BEGIN
WebBrowser1.Navigate('about:blank');
while WebBrowser1.ReadyState Application.ProcessMessages;
if Assigned(WebBrowser1.Document) then
begin
sl := TStringList.Create;
try
ms := TMemoryStream.Create;
try
sl.Text := Memo1.Text;
sl.SaveToStream(ms);
ms.Seek(0, 0);
(WebBrowser1.Document as IPersistStreamInit).Load(TStreamAdapter.Create(ms));
finally
ms.Free;
end;
finally
sl.Free;
end;
end;