【发布时间】:2020-05-07 21:14:53
【问题描述】:
我正在尝试创建一个 Windows Phone 7.1 应用程序,基本上是一个货币转换器。我正在使用DownloadStringAsync 方法从特定网站获取包含汇率的短字符串。我在 Visual Studio 2010 中进行了测试,DownloadString 工作得很好。但不适用于电话应用程序。我需要在这里做什么?我真的无法理解它。
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
结束类
【问题讨论】:
标签: vb.net visual-studio-2010 windows-phone windows-phone-7.1 downloadstring