?
Solved

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

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
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
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

765 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