Witam. Piszę prosty program który pobiera plik ze strony i zapisuje go (tutaj wszystko działa). Chciałem dodać label, który będzie pokazywał stan pobierania. Niestety tu pojawia się problem - średnio rozumiem zdarzenia. Mógłbym wiedzieć co robię źle ?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
namespace PobieraniePlikuf
{
public partial class Form1 : Form
{
WebClient pobieranie;
public Form1()
{
InitializeComponent();
pobieranie = new WebClient();
}
private void DlButton_Click(object sender, EventArgs e)
{
try
{
pobieranie.DownloadFile(UrlTextBox.Text, @SaveBox.Text);
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
}
}
private void pobieranie_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
label1.Text = Convert.ToString(e.ProgressPercentage);
}
}
}