Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
B

BlackChart

@BlackChart
About
Posts
4
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Problem fetching page in Windows Phone 8.1, VB.NET
    B BlackChart

    Your example lead me to this, found on another site:

    Public Sub getData(ByVal gType As String)
    Dim addr As Uri = New Uri("http://smarthome.trab.dk/wpf/getData.php?g=" + gType)

    Dim client As New WebClient()
    AddHandler client.DownloadStringCompleted, AddressOf client\_DownloadStringCompleted
    client.DownloadStringAsync(addr)
    

    End Sub

    Private Sub client_DownloadStringCompleted(sender As Object, e As DownloadStringCompletedEventArgs)

    Dim data As String = e.Result
    MessageBox.Show(data)
    

    End Sub

    And it returns the data :)

    Mobile csharp php database wpf

  • Problem fetching page in Windows Phone 8.1, VB.NET
    B BlackChart

    Did you test this on a mobile device? Errors: 'Using' operand of type 'System.Net.WebClient' must implement 'System.IDisposal' 'DownloadString' is not a member of 'System.Net.WebClient'

    Mobile csharp php database wpf

  • Problem fetching page in Windows Phone 8.1, VB.NET
    B BlackChart

    The line it strands on are:

    Dim response As HttpResponseMessage = Await httpClient.GetAsync("/wpf/getData.php?g=" + gType.ToLower)

    Way before returning anything to the app.

    Mobile csharp php database wpf

  • Problem fetching page in Windows Phone 8.1, VB.NET
    B BlackChart

    I'm trying to make a small app to fetch some numbers from my smarthome webpage. When trying the query in a browser like Chrome (uri: http://smarthome.trab.dk/wpf/getData.php?g=power) everything works. In the app, it just stalls - no exceptions or errors but no data either. The module is like this:

    Public uriString As String = "http://smarthome.trab.dk"
    
    Public Async Function getData(ByVal gType As String) As Tasks.Task(Of String)
        Try
            Dim Resp As String = Nothing
    
            Using httpClient As New HttpClient
                httpClient.BaseAddress = New Uri(uriString)
                httpClient.Timeout = TimeSpan.FromSeconds(10)
    
                Dim response As HttpResponseMessage = Await httpClient.GetAsync("/wpf/getData.php?g=" + gType.ToLower)
    
                Resp = Await response.Content.ReadAsStringAsync
            End Using
    
            Return Resp
        Catch webEx As HttpRequestException
            MessageBox.Show(webEx.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Function
    
    Public Function ACount() As String
        Dim resp As String = getData("power").Result
    
        Return "Actual: " + resp
    End Function
    

    Can anyone see what the problem is?

    Regards, Morten Trab

    Mobile csharp php database wpf
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups