public partial class FileCopy : Form { onStartButtonClick() { Thread fileReaderWriter = new Thread(new ThreadStart(doFileCopy)); fileReaderWriter.Start(); } doFileCopy() { while(file.length> 0) { //read data //write data reportProgress(someValue); } MessageBox.show("File Copied"); disableControl(); } private void disableControl() { progressbar1.hide(); } private void ReportProgress(int _nValue) { progressBar1.BeginInvoke((Action)(() => { progressBar1.Value = _nValue; progressBar1.Update(); })); label4.BeginInvoke((Action)(() => { label4.Text = " some Text"; })); label5.BeginInvoke((Action)(() => { label5.Text = " Time remaining " + _lTimeRemaining + " s"; })); } } <pre> Progress bar is get updated its not hiding the progressbar after file copied message.It get hange on disableControl() method.How can I hide progress bar?
Why do you call Join on the created thread? That operation causes the UI thread to be blocked until the created thread has finished its work...
Join
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)