0
我正在嘗試創建一個基於貨幣轉換器的Windows Phone 7.1應用程序。我正在使用DownloadStringAsync
方法獲取包含特定網站匯率的短字符串。我在Visual Studio 2010中測試過,DownloadString
工作得很好。但不適用於電話應用程序。我需要在這裏做什麼?我無法真正理解它。DownloadStringAsync獲取文本字符串?
Partial Public Class MainPage
Inherits PhoneApplicationPage
Dim webClient As New System.Net.WebClient
Dim a As String
Dim b As String
Dim result As String = Nothing
' Constructor
Public Sub New()
InitializeComponent()
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
a = "USD"
b = "GBP"
webClient = New WebClient
Dim result As String = webClient.DownloadStringAsync(New Uri("http://rate-exchange.appspot.com/currency?from=" + a + "&to=" + b) as String)
TextBox1.Text = result
End Sub
末級