Solved

No overload for 'DownloadStringCallback2' matches delegate 'System.Net.DownloadStringCompletedEventHandler'

Posted on 2007-11-19
1
1,235 Views
Last Modified: 2013-12-17
Hi,

I copied this method from MSDN:

http://msdn2.microsoft.com/en-us/library/system.net.webclient.downloadstringcompleted.aspx

        // Sample call : DownloadStringInBackground2 ("http://www.contoso.com/GameScores.html");
        public static void DownloadStringInBackground2(string address)
        {
            WebClient client = new WebClient();
            Uri uri = new Uri(address);

            // Specify that the DownloadStringCallback2 method gets called
            // when the download completes.
            client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(DownloadStringCallback2);
            client.DownloadStringAsync(uri);
        }

        private void DownloadStringCallback2()
        {
            MessageBox.Show("H");
        }

And I'm getting this error message:

Error      1      No overload for 'DownloadStringCallback2' matches delegate 'System.Net.DownloadStringCompletedEventHandler'      ...


What is wrong?
0
Comment
Question by:EEssam
1 Comment
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 500 total points
ID: 20315418
you don't match the proper signature for the delegate http://msdn2.microsoft.com/en-us/library/system.net.downloadstringcompletedeventhandler.aspx

it should be:

        private void DownloadStringCallback2(Object sender,
      DownloadStringCompletedEventArgs e)
        {
            MessageBox.Show("H");
        }
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Image(2) 3 29
Trouble connecting to SqlServer database 4 34
Spacing between controls 4 17
Different Delete Messages 7 23
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now