Source code:
Using System;
Using System. Collections. Generic;
Using System. ComponentModel;
Using System. Data;
Using System. Drawing;
Using System. Linq;
Using System. Text;
Using System. Windows. Forms;
Using System. Diagnostics;
Using System. Net;
Using System. Threading;
Namespace WindowsFormsApplication13
{
Public partial class Form1: Form
{
P rivate String html1 = null;
Public String Html1
{
Get {return this.html 1 ;}
Set {this.html 1 = value ;}
}
Public Form1 ()
{
InitializeComponent ();
}
P rivate void button#click (object sender, EventArgs e)
{
Thread myThread1;
MyThread1 = new Thread (readwebsite );
MyThread1.Start (object) textBox1.Text );
}
P rivate void readwebsite (object url)
{
This. Html1 = gethtml (String) url );
MethodInvoker mi = new MethodInvoker (richtextbox_invokefun );
This. BeginInvoke (mi );
}
P rivate String gethtml (String url)
{
WebClient web1 = new WebClient ();
Byte [] data1 = web1.downloaddata (URL );
String html = encoding. Default. getstring (data1 );
Return HTML;
}
P rivate void richtextbox_invokefun ()
{
Richtextbox1.text = This. html1;
}
}
}
Source code download