Solved

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

Posted on 2007-11-19
1
1,241 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

696 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