errors when using downloadata to download a file

0

Hello, I am trying to download a text file using download data, the code that I try is such that:

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
namespace Crypter
{
    class Program
    {
        private static WebClient web = new WebClient();
        [STAThread]
        static void Main(string[] args)
        {
                web.DownloadProgressChanged += new DownloadProgressChangedEventHandler(Program.load.ProgressChanged);
                web.DownloadDataCompleted += web_DownloadDataCompleted;
                web.DownloadDataAsync(new Uri("direccion"));

                while (web.IsBusy)
                    Thread.Sleep(500);

                web.DownloadDataCompleted -= web_DownloadDataCompleted;
                if (true)
                {
                    web.DownloadDataAsync(new Uri("direccion"), @"c:\Users\user\Desktop\fichero.txt");
                }
                else
                {
                    web.DownloadDataAsync(new Uri("direccion"), @"c:\Users\user\Desktop\fichero.txt");
                }
        }


}
}

but I get errors;

a.cs(20,84): error CS0117: 'Program' does not contain a definition for 'load'
a.cs(21,46): error CS0103: The name 'web_DownloadDataCompleted' does not exist i
n the current context
a.cs(27,46): error CS0103: The name 'web_DownloadDataCompleted' does not exist i
n the current context
a.cs(34,21): warning CS0162: Unreachable code detected

Someone who can guide me to use correctly downloaddata to download my text file?

    
asked by Sergio Ramos 06.02.2018 в 05:35
source

0 answers