I wanna use OpenReadAsync instead of OpenRead because its blocking my Form....

But i cant get it work....

Ok... Im programming in C++/Cli but its not rly different.

IO::StreamReader^ sr = gcnew IO::StreamReader(webClientOther->OpenReadAsync(gcnew Uri("Site")));

In C#?

IO.StreamReader^ sr = new IO.StreamReader(webClientOther.OpenReadAsync(new Uri("Site")));

I hope I "translated" it right...

But then the error appears: "Cannot convert void to System::IO::Stream".

Hope someone can help me :D.
You can post the right code in C# ;).


>But then the error appears: "Cannot convert void to System::IO:tream

Because of its signature - void OpenReadAsync()

Have a look,

void readCompleted(System::Object^  sender, System::Net::OpenReadCompletedEventArgs  ^  e) {
	Console::WriteLine("Data: " + e->Cancelled);
	Console::WriteLine("Object : " + e->UserState);
	IO::StreamReader^ sr=gcnew IO::StreamReader(e->Result);
int main(array<System::String ^> ^args)
  	WebClient^ wc=gcnew WebClient();
	wc->OpenReadCompleted+=gcnew  OpenReadCompletedEventHandler(&readCompleted);
	wc->OpenReadAsync(gcnew Uri("http://x/y/z.txt",UriKind::Absolute),gcnew Object());

    return 0;