0
我在与Web客户端的问题,以显示。我有一个TextBox(用于URL),然后是一个提交按钮,它调用TextBox.Text,然后执行WebClient的东西。然后我想在TextBlock.text中显示HTML,但它不会显示,除非我快速两次或更多。Web客户端和DownloadString,确保字符串完全下载在TextBlock.Text
WebClient search_client = new WebClient();
search_client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(search_client_DownloadStringCompleted);
search_client.DownloadStringAsync(new System.Uri(URL));
那么对于DownloadStringCompletedEventHandler,我如果e.Error == null
然后做this.html = e.Result
。全班声明html
。
我想,以确保Web客户端下载完成,因此它可以在TextBlock中显示。