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 (new ThreadStart (readwebsite ));
MyThread1.Start ();
}
P rivate void readwebsite ()
{
This. Html1 = gethtml (textBox1.Text. Trim ());
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