【发布时间】:2009-10-18 22:20:37
【问题描述】:
public string[] SearchForMovie(string SearchParameter)
{
WebClientX.DownloadDataCompleted += new
DownloadDataCompletedEventHandler(WebClientX_DownloadDataCompleted);
WebClientX.DownloadDataAsync(新的 Uri(
"http://www.imdb.com/find?s=all&q=ironman+&x=0&y=0"));
string sitesearchSource = Encoding.ASCII.GetString(Buffer);
}
void WebClientX_DownloadDataCompleted(object sender,
DownloadDataCompletedEventArgs e)
{
Buffer = e.Result;
throw new NotImplementedException();
}
我得到了这个例外:
矩阵不能为空。引用我的byte[]变量Buffer。
因此,我可以得出结论,DownloadDataAsync 并没有真正下载任何内容。是什么导致了这个问题?
附言。如何轻松格式化我的代码,使其在此处正确缩进。为什么我不能从 Visual C# express 复制过去的代码并在此处保持缩进?谢谢! :D
【问题讨论】:
标签: c# winforms asynchronous webclient