111,126
社区成员
发帖
与我相关
我的任务
分享
private void button2_Click(object sender, EventArgs e)
{
WebClient wc = new WebClient();
wc.DownloadStringAsync(new Uri("http://www.baidu.com"));
wc.DownloadStringCompleted += wc_DownloadStringCompleted;
}
void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
textBox1.Text = e.Result;
}
private void button2_Click(object sender, EventArgs e)
{
Thread th = new Thread(GetString);
th.IsBackground = true;
th.Start();
}
public void GetString()
{
WebClient client = new WebClient();
string result = client.DownloadString(网址);
this.Invoke(new Action(() => this.richTextBox.Text = result));
}
