简体   繁体   中英

VB.NET WebClient Windows Phone 7

i would like to know how i can get a page source code using vb.net webclient for windows phone 7.

I found a C# example but i need a vb.net example.

Thanks!

C# (The code i found on internet)

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# to VB website output)

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

Try running the C# example through a C#-to-VB conversion utility such as Code Translator .

It's probably also a good idea to post the sample you found--maybe someone will be willing to translate it for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM