| 
 | 
private WebRequest httpRequest; 
        private WebResponse httpResponse; 
        private byte[] buffer; 
        private Thread downloadThread; 
        Stream ns; 
        private FileStream fs; 
        private long length; 
        private long downlength = 0; 
        private long lastlength = 0; 
        public delegate void updateData(string value); //Set the delegate to update the main interface 
        private int totalseconds = 0; //total time 
        private updateData UIDel; 
        private string filename = @"d:\sybaohj.wmv"; 
        private int DownLoadNumber = 0; //File download count 
 
 private void downloadFile() 
        { 
            ns = httpResponse.GetResponseStream(); 
 
            int i; 
            UIDel = new updateData(updateUI); 
            while ((i = ns.Read(buffer, 0, buffer.Length))> 0) 
            { 
 
                downlength += i; 
                string value = downlength.ToString(); 
                this.Invoke(UIDel, value); 
                fs.Write(buffer, 0, i); 
            } 
            speedlabel1.Text = "Download complete"; 
        } 
        /* private void show() 
         { 
             UIDel = new updateData(updateUI); 
             int value = 0; 
             while (value <= 100) 
             { 
                 this.progressBar1.Value = value; 
                 value++; 
             } 
         }*/ 
        void updateUI(string value) 
        { 
            this.lensthlabel1.Text = "Download size:"+value; 
            this.progressBar1.Value = Int32.Parse(value); 
        } 
 
Download the code and enter ``crash is that the system is not responding'' and it will not automatically shut down and exit |   
 
 
 
 |