now ive got two forms Form1 for my WebBrowser and Form2 for showing the source of the current webbrowser, but i get the error: An object reference is required for the nonstatic field, method, or property 'WindowsApplication1.Form2.textBox1'.
Form2 has a TextBox called textBox1
GetCurrentWebBrowser is the code to see what web page is selected.
this is my code for show source button:
Expand|Select|Wrap|Line Numbers
- private void ShowSource_Click(object sender, EventArgs e)
- {
- Form source = new Form2();
- source.Show();
- WebBrowser thiswebpage = GetCurrentWebBrowser();
- mshtml.HTMLDocumentClass doc = (mshtml.HTMLDocumentClass)thiswebpage.Document.DomDocument;
- Form2.textBox1.Text = "<html>" + doc.IHTMLDocument2_body.outerHTML + "</html>";
- }