This is the code, i want my form keep be alive while downloading code from internet and when its finish i want to update html container. When i do this form freeze. I am new to threading and tasking and i need little help. Thanks!
private void buttonGetHTML_Click(object sender, EventArgs e)
{
Task.Run(() => Download(textBoxUrl.Text)).ContinueWith((Download) => htmlContent.Text = Download.Result);
}
private string Download(string url)
{
using (WebClient client = new WebClient())
{
string context = client.DownloadString(url);
return context;
}
}