473,387 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

copy HTML information

I am trying to automatically relay information displayed on an HTML page to
my program I am writing in VB.net. I know the window handle, the window
title, and process, but do not know what to do next.
Aug 22 '06 #1
4 1579

"Daniel N" <De******@yahoo.comwrote in message
news:my*************@newsfe12.lga...
>I am trying to automatically relay information displayed on an HTML page to
my program I am writing in VB.net. I know the window handle, the window
title, and process, but do not know what to do next.

Hope this one helps:

Dim HttpWebReq As System.Net.HttpWebRequest
Dim WebResp As System.Net.HttpWebResponse
Dim WebStream As System.IO.Stream
Dim WebReader As System.IO.StreamReader
Dim PageHTML As String

HttpWebReq = CType(WebRequest.Create("http://www.contoso.com/"),
HttpWebRequest)
WebResp = CType(HttpWebReq.GetResponse(), System.Net.HttpWebResponse)
WebStream = WebResp.GetResponseStream
WebReader = New System.IO.StreamReader(WebStream, Encoding.Default)
PageHTML = WebReader.ReadToEnd
WebResp.Close() ' Close finally to free resources
Aug 23 '06 #2
How should I declare WebRequest, HttpWebRequest and Encoding? They come up undeclaured when I copy and paste.

I just wanted to read one section of informaiton from a website, but I dont not know the site address, an executable launches a web app that gives me certian information, and I just wanted to copy that into a string or integer.

Thanks for the help

"Timo" <ti*************@luukku.com
Hope this one helps:

Dim HttpWebReq As System.Net.HttpWebRequest
Dim WebResp As System.Net.HttpWebResponse
Dim WebStream As System.IO.Stream
Dim WebReader As System.IO.StreamReader
Dim PageHTML As String

HttpWebReq = CType(WebRequest.Create("http://www.contoso.com/"),
HttpWebRequest)
WebResp = CType(HttpWebReq.GetResponse(), System.Net.HttpWebResponse)
WebStream = WebResp.GetResponseStream
WebReader = New System.IO.StreamReader(WebStream, Encoding.Default)
PageHTML = WebReader.ReadToEnd
WebResp.Close() ' Close finally to free resources

Aug 23 '06 #3
Ok. Import namespaces:

Imports System.IO
Imports System.Net
Imports System.Text

that should help. Variable PageHTML will contain the content
of the www-page. Extract the section from it. Replace
"http://www.contoso.com/" with the url you want to access.
However, if you do not know the url then this won't be the
solution you're looking for.

- Timo

"Daniel N" <De******@yahoo.comwrote in message news:4y***********@newsfe09.lga...
How should I declare WebRequest, HttpWebRequest and Encoding? They come up undeclaured when I copy and paste.

I just wanted to read one section of informaiton from a website, but I dont not know the site address, an executable launches a web app that gives me certian information, and I just wanted to copy that into a string or integer.

Thanks for the help

"Timo" <ti*************@luukku.com
Hope this one helps:

Dim HttpWebReq As System.Net.HttpWebRequest
Dim WebResp As System.Net.HttpWebResponse
Dim WebStream As System.IO.Stream
Dim WebReader As System.IO.StreamReader
Dim PageHTML As String

HttpWebReq = CType(WebRequest.Create("http://www.contoso.com/"),
HttpWebRequest)
WebResp = CType(HttpWebReq.GetResponse(), System.Net.HttpWebResponse)
WebStream = WebResp.GetResponseStream
WebReader = New System.IO.StreamReader(WebStream, Encoding.Default)
PageHTML = WebReader.ReadToEnd
WebResp.Close() ' Close finally to free resources

Aug 24 '06 #4
How do I post that information into like a text box or a string?
"Timo" <ti*************@luukku.comwrote in message news:g_******************@reader1.news.jippii.net. ..
Ok. Import namespaces:

Imports System.IO
Imports System.Net
Imports System.Text

that should help. Variable PageHTML will contain the content
of the www-page. Extract the section from it. Replace
"http://www.contoso.com/" with the url you want to access.
However, if you do not know the url then this won't be the
solution you're looking for.

- Timo

"Daniel N" <De******@yahoo.comwrote in message news:4y***********@newsfe09.lga...
How should I declare WebRequest, HttpWebRequest and Encoding? They come up undeclaured when I copy and paste.

I just wanted to read one section of informaiton from a website, but I dont not know the site address, an executable launches a web app that gives me certian information, and I just wanted to copy that into a string or integer.

Thanks for the help

"Timo" <ti*************@luukku.com
Hope this one helps:

Dim HttpWebReq As System.Net.HttpWebRequest
Dim WebResp As System.Net.HttpWebResponse
Dim WebStream As System.IO.Stream
Dim WebReader As System.IO.StreamReader
Dim PageHTML As String

HttpWebReq = CType(WebRequest.Create("http://www.contoso.com/"),
HttpWebRequest)
WebResp = CType(HttpWebReq.GetResponse(), System.Net.HttpWebResponse)
WebStream = WebResp.GetResponseStream
WebReader = New System.IO.StreamReader(WebStream, Encoding.Default)
PageHTML = WebReader.ReadToEnd
WebResp.Close() ' Close finally to free resources

Aug 24 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: cv | last post by:
Hi all, I have to copy two set of data from 2 files(notepad/excel) say, products and their corresponding prices to list/textarea/table. I should be able to retrieve the product and corresponding...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
1
by: brussel | last post by:
I'm trying to copy information in one iframe to another iframe with javascript. I am using firefox and information from my local domain so there are no security issues. However I'm just not getting...
2
by: Swinky | last post by:
I hope someone can help...I feel like I'm walking in the dark without a flashlight (I'm NOT a programmer but have been called to task to do some work in Access that is above my head). I have...
1
by: Troels Arvin | last post by:
Hello, publib.boulder.ibm.com has been rather unstable lately, so I figured I should install a local copy of the documentation web pages. I grabbed the Windows-version of the offline version...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.