ANASAYFA

ANASAYFA

4.07.2013

C# Dosya İndirme Programı


 private void button1_Click(object sender, EventArgs e)//indir butonuna basıldıgında
        {
            string url =textBox1.Text;
            WebClient client = new WebClient();
            client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
            client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
            client.DownloadFileAsync(new Uri(url), "C:\\program.exe");
        }
        void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            progressBar1.Value = e.ProgressPercentage;
            progressBar1.Text = progressBar1.Value.ToString() + "%";
         
        }

        void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            MessageBox.Show("İNDİRME TAMAMLANDI");
        }

Hiç yorum yok:

Yorum Gönder