2012-03-12 70 views
1

我想知道我可以用vb.net Web客户端的Windows手机7VB.NET Web客户端的Windows Phone 7

我发现了一个C#示例获取一个网页的源代码,但我需要一个vb.net例子。

谢谢!

C#(ⅰ互联网上找到的代码)

public void GetFeed() 

{ 

    WebClient client = new WebClient(); 

    client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted); 

    client.DownloadStringAsync(new Uri("http://www.slpg.org/syndication.axd")); 

} 



void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) 

{ 

    string data = e.Result; 

    // do something with the feed here 

} 

VB.Net(C#到VB网站输出)

Public Sub GetFeed() 


    Dim client As New WebClient() 

    client.DownloadStringCompleted += New DownloadStringCompletedEventHandler(AddressOf client_DownloadStringCompleted) 

    client.DownloadStringAsync(New Uri("http://www.slpg.org/syndication.axd")) 

End Sub 



Private Sub client_DownloadStringCompleted(sender As Object, e As DownloadStringCompletedEventArgs) 


    Dim data As String = e.Result 

    ' do something with the feed here 

End Sub 

回答

0

尝试通过C#运行C#示例-to-VB转换实用程序,如Code Translator

发布您找到的样本可能也是一个好主意 - 也许有人会愿意为您翻译它。

+0

这个网站你发送的作品真的很好!谢谢! – 2012-03-12 18:31:18