Is it possible to view the code of the site that is loaded into the webbrowser?

eg;

webBrowser1.Navigate("http://google.com");

webBrowser1.Contents = HTML;

Or is is possible to save it as a file instead?

Yes it's possible. You can simple do

webBrowser1.DocumentText

Yes it's possible. You can simple do

webBrowser1.DocumentText

I get the error;

"Only assignment, call, increment, decrement, and new object expressions can be used as a statement"

Can you elaborate on what you mean please?

Gets or sets the HTML contents of the page displayed in the WebBrowser control.

MSDN WebBrowser.DocumentText Property
Try using something like this.

string pageContents = webBrowser1.DocumentText;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.