September 18th, 2012, 01:30 AM
[C#] Adding Event Listener to static void Main() fails, why?
Trying to download some strings from a webpage, then fires an event for each download that completes. However, when trying to add the event listener, the program throws the following error:
An object reference is required for the non-static field, method, or property 'Test.Program.client_OpenReadCompleted(object, System.Net.OpenReadCompletedEventArgs)'
Code is here: http://codepad.org/mAZVd4DJ
The line with the error is line 22.
How can I get around this?
Please let me know if you require more information, thanks!
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!