Replacement for Inet Control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jerry Spence1

    #1

    Replacement for Inet Control

    The following seemed so easy in VB6

    Inet2.URL = HTTP://192.168.0.200/get?brightness

    Dim retval As String = AxInet2.OpenURL


    This would give me the string 'Brightness=34' (It's from a camera)

    How do I do it with VB.Net (2005)? I've trawled through loads of code using
    Webrowsers, HTTPWepresponse etc but can't get a result.

    -Jerry


  • M. Posseth

    #2
    RE: Replacement for Inet Control


    Dim URI As String = "HTTP://192.168.0.200/get?brightness"

    Dim wbClient As New WebClient
    Dim strData As Stream = wbClient.OpenRe ad(URI)
    Dim sr As StreamReader = New StreamReader(st rData)

    the return data is now in the streamreader ( use the sr `s methods to
    retreive the data in the desired format )

    note that you need to set up a proxy object and bind this to the webclient
    if you are behind a proxy server

    regards

    Michel Posseth [MCP]







    "Jerry Spence1" wrote:
    The following seemed so easy in VB6
    >
    Inet2.URL = HTTP://192.168.0.200/get?brightness
    >
    Dim retval As String = AxInet2.OpenURL
    >
    >
    This would give me the string 'Brightness=34' (It's from a camera)
    >
    How do I do it with VB.Net (2005)? I've trawled through loads of code using
    Webrowsers, HTTPWepresponse etc but can't get a result.
    >
    -Jerry
    >
    >
    >

    Comment

    • Patrice

      #3
      Re: Replacement for Inet Control

      "can't get a result". Do you mean you have an error or that you just don't
      get any response ?

      Seeing some code could help. System.Net.WebC lient is likely the easiest path
      for now. For example :
      Dim w As New System.Net.WebC lient
      MsgBox(w.Downlo adString("http://www.google.com/"))
      w.Dispose()



      Is the target page under your control ? For example a site could perhaps
      return nothing at all if the user agant is empty...

      ---

      Patrice


      "Jerry Spence1" <jerry.spence@s omewhere.coma écrit dans le message de
      news: 44b4ecb0$0$2208 7$ed2619ec@ptn-nntp-reader01.plus.n et...
      The following seemed so easy in VB6
      >
      Inet2.URL = HTTP://192.168.0.200/get?brightness
      >
      Dim retval As String = AxInet2.OpenURL
      >
      >
      This would give me the string 'Brightness=34' (It's from a camera)
      >
      How do I do it with VB.Net (2005)? I've trawled through loads of code
      using Webrowsers, HTTPWepresponse etc but can't get a result.
      >
      -Jerry
      >
      >

      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: Replacement for Inet Control

        "Jerry Spence1" <jerry.spence@s omewhere.comsch rieb:
        Inet2.URL = HTTP://192.168.0.200/get?brightness
        >
        Dim retval As String = AxInet2.OpenURL
        >
        >
        This would give me the string 'Brightness=34' (It's from a camera)
        >
        How do I do it with VB.Net (2005)? I've trawled through loads of code
        using Webrowsers, HTTPWepresponse etc but can't get a result.
        <URL:http://dotnet.mvps.org/dotnet/code/net/#InternetLoadFi le>

        --
        M S Herfried K. Wagner
        M V P <URL:http://dotnet.mvps.org/>
        V B <URL:http://classicvb.org/petition/>

        Comment

        • Jerry Spence1

          #5
          Re: Replacement for Inet Control

          Ah - that's perfect. Thank you very much

          -Jerry

          "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.atwrot e in message
          news:ez3E4RbpGH A.5104@TK2MSFTN GP04.phx.gbl...
          "Jerry Spence1" <jerry.spence@s omewhere.comsch rieb:
          >Inet2.URL = HTTP://192.168.0.200/get?brightness
          >>
          >Dim retval As String = AxInet2.OpenURL
          >>
          >>
          >This would give me the string 'Brightness=34' (It's from a camera)
          >>
          >How do I do it with VB.Net (2005)? I've trawled through loads of code
          >using Webrowsers, HTTPWepresponse etc but can't get a result.
          >
          <URL:http://dotnet.mvps.org/dotnet/code/net/#InternetLoadFi le>
          >
          --
          M S Herfried K. Wagner
          M V P <URL:http://dotnet.mvps.org/>
          V B <URL:http://classicvb.org/petition/>

          Comment

          Working...