2012-03-12 67 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