Guten Morgen,
ich habe VS Community 2015 und einen Raspberry Pi mit Windows 10 IOT. Ich möchte den Raspberry Pi nutzen um Börsenkurse zu überwachen. Ich habe folgende funktionstüchtige Windows Forms Anwendung geschrieben:
Dieses Programm möchte ich auf dem Raspberry ausführen. Ich habe dazu ein neues Windows App Projekt erzeugt. Dabei tritt folgender Fehler auf:
Im Folgenden der Code der Windows App (der Button hat z.Z. keine Funktion aber trotzdem müsste das Programm fehlerfrei starten):
Habt ihr einen Erklärung für mich?
Im Voraus vielen Dank!
Besten Gruß,
Christoph
ich habe VS Community 2015 und einen Raspberry Pi mit Windows 10 IOT. Ich möchte den Raspberry Pi nutzen um Börsenkurse zu überwachen. Ich habe folgende funktionstüchtige Windows Forms Anwendung geschrieben:
VB.NET-Quellcode
- Imports System.Net
- Imports System.IO
- Public Class Form1
- Private Prices As List(Of Single) = Nothing
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- Chart1.Series.Add(TextBox1.Text)
- Chart1.ChartAreas(0).AxisX.Title = "Days"
- Chart1.ChartAreas(0).AxisY.Title = "Stock price in €"
- Chart1.Series(TextBox1.Text).ChartType = DataVisualization.Charting.SeriesChartType.Line
- Prices = GetStockPrices(TextBox1.Text)
- For Each eintrag In Prices
- ListBox1.Items.Add(eintrag)
- Chart1.Series(TextBox1.Text).Points.AddY(eintrag)
- Next
- End Sub
- Private Function GetStockPrices(ByVal symbol As String) As List(Of Single)
- ' Compose the URL.
- Dim url As String = "http://www.google.com/finance/historical?output=csv&q=" & symbol
- ' Get the result.
- ' Get the web response.
- Dim result As String = GetWebResponse(url)
- ' Get the historical prices.
- Dim lines() As String = result.Split(
- New String() {vbCr, vbLf},
- StringSplitOptions.RemoveEmptyEntries)
- Dim prices As New List(Of Single)()
- ' Process the lines, skipping the header.
- For i As Integer = 1 To lines.Length - 1
- Dim line As String = lines(i)
- line = line.Replace(",", ";")
- line = line.Replace(".", ",")
- prices.Add(Single.Parse(line.Split(";"c)(4)))
- Next i
- Return prices
- End Function
- Private Function GetWebResponse(ByVal url As String) As String
- ' Make a WebClient.
- Dim web_client As New WebClient()
- ' Get the indicated URL.
- Dim response As Stream = web_client.OpenRead(url)
- ' Read the result.
- Using stream_reader As New StreamReader(response)
- ' Get the results.
- Dim result As String = stream_reader.ReadToEnd()
- ' Close the stream reader and its underlying stream.
- stream_reader.Close()
- ' Return the result.
- Return result
- End Using
- End Function
- End Class
Dieses Programm möchte ich auf dem Raspberry ausführen. Ich habe dazu ein neues Windows App Projekt erzeugt. Dabei tritt folgender Fehler auf:
Der Typ "WebClient" ist nicht definiert.
Im Folgenden der Code der Windows App (der Button hat z.Z. keine Funktion aber trotzdem müsste das Programm fehlerfrei starten):
Habt ihr einen Erklärung für mich?
Im Voraus vielen Dank!
Besten Gruß,
Christoph