Solved

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

Posted on 2007-11-19
1
1,239 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Powershell File Sort 8 41
What are the simplest ways to create a Merge Sort? 3 29
SSRS Deployment problem 5 66
Code works but breaks when I add one section 4 20
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

860 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