Home All Groups Group Topic Archive Search About

Replacement for Inet Control

Author
12 Jul 2006 12:35 PM
Jerry Spence1
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

Author
12 Jul 2006 1:00 PM
M. Posseth
Dim URI As String = "HTTP://192.168.0.200/get?brightness"

        Dim wbClient As New WebClient
        Dim strData As Stream = wbClient.OpenRead(URI)
        Dim sr As StreamReader = New StreamReader(strData)

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]







Show quoteHide quote
"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
>
>
>
Author
12 Jul 2006 1:06 PM
Patrice
"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.WebClient is likely the easiest path
for now. For example :
        Dim w As New System.Net.WebClient
        MsgBox(w.DownloadString("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.spe***@somewhere.com> a écrit dans le message de
news: 44b4ecb0$0$22087$ed261***@ptn-nntp-reader01.plus.net...
Show quoteHide quote
> 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
>
>
Author
12 Jul 2006 1:09 PM
Herfried K. Wagner [MVP]
"Jerry Spence1" <jerry.spe***@somewhere.com> schrieb:
> 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/#InternetLoadFile>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
13 Jul 2006 12:57 PM
Jerry Spence1
Ah - that's perfect. Thank you very much

-Jerry

Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:ez3E4RbpGHA.5104@TK2MSFTNGP04.phx.gbl...
> "Jerry Spence1" <jerry.spe***@somewhere.com> schrieb:
>> 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/#InternetLoadFile>
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>