EgyEast
EgyEast

Reputation: 1572

How can i display stored html codes in webbrowser control in C# windows form application without creating html files on hard drive?

I have a database which has stored HTML code sources for different articles which are not in similar HTML design pattern. I want to display these codes in windows form application control e.g WebBrowser control so that it can be displayed in its original HTMLdesign style as if in the browser.But i hope if this process doesn't include creating html files on hard drive to read from it and i wish if there is a way to make the WebBrowser control navigate from objects created in the memory not created on hard drive .. For example i wish if the code could be like this :

HTMLFile myfile = new HTML File (htmlcode);
webbrowser1.Navigate(myfile);

Upvotes: 1

Views: 3022

Answers (1)

rsbarro
rsbarro

Reputation: 27359

You should be able to do this using the DocumentText property of the WebBrowser control.

For example:

webBrowser1.DocumentText = "<html><body><h1>This is a test</h1></body></html>";

See this post for more info: C# WebBrowser HTML with references to scripts and images

Upvotes: 3

Related Questions