This documentation is archived and is not being maintained.
OpenReadCompletedEventHandler Delegate
Visual Studio 2010
Represents the method that will handle the OpenReadCompleted event of a WebClient.
Assembly: System (in System.dll)
public delegate void OpenReadCompletedEventHandler( Object^ sender, OpenReadCompletedEventArgs^ e )
Parameters
- sender
- Type: System::Object
The source of the event.
- e
- Type: System.Net::OpenReadCompletedEventArgs
A OpenReadCompletedEventArgs containing event data.
The following code example demonstrates downloading a resource for reading.
The following method is called when the download completes.
void OpenReadCallback2( Object^ /*sender*/, OpenReadCompletedEventArgs^ e ) { Stream^ reply = nullptr; StreamReader^ s = nullptr; try { reply = dynamic_cast<Stream^>(e->Result); s = gcnew StreamReader( reply ); Console::WriteLine( s->ReadToEnd() ); } finally { if ( s != nullptr ) { s->Close(); } if ( reply != nullptr ) { reply->Close(); } } }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: