Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2007-11-19
1
Medium Priority
?
1,262 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

636 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