I am trying to download a file from an url using WebClient and multi thread. I am trying to get ProgressPercentage while downloading file and I am trying to do that with DownloadProgressChanged but when I try to print percentage to with debug.WriteLine everything is okey. But when I want to change my textbox.text its not working. I want to update my textbox while downloading.
With this one I am calling a function.
wc.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChangedEventHandler);
This is the content of function:
public void DownloadProgressChangedEventHandler(object sender, DownloadProgressChangedEventArgs e)
{
//Debug.WriteLine works normal.
Debug.WriteLine(e.ProgressPercentage);
TextBox1.Text = "Progress:" +e.ProgressPercentage.ToString();
progressBarDownload3.Style.Add("width",e.ProgressPercentage.ToString()+"%");
}