Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

html table

Hi all, i have a question and sont know where to start searching so any pointers would be usefull.
Basically i have a table that i download that shows status of an appliace i use
eg

Type Data Last
1 2 1/1/03
2 1 1/1/04
etc
There is a maximum of 36 lines dependant upon config of the device. What i would like to do is to get the above table say once per second and to take the varios values and place them in relevant text boxes. I have done it with a text file but i dont know how to make it work with a html document.

Many Thanks

James
[611 byte] By [jameswilson] at [2007-11-11 8:47:27]
# 1 Re: html table
It would be almost the same for an html document as it would be for a text document. Without seeing the html document I can't tell you exactly how to do it. But you would need to search through the html document (as if it was a text file) looking for the appropriate table tags e.g. <td> and <tr>, etc
xnemsis at 2007-11-11 21:47:02 >
# 2 Re: html table
Thanks for your reply i have ended up with

'Get data as string from web server
Dim wr As System.Net.WebRequest = System.Net.WebRequest.Create("http://127.0.0.1/status")
Dim wresp As System.Net.WebResponse = wr.GetResponse()
Dim s As IO.Stream = wresp.GetResponseStream()
Dim sr As IO.StreamReader = New IO.StreamReader(s)
Dim resp As String = sr.ReadToEnd()
'MsgBox(resp)

'Split per line into array
Dim arrlines() As String
arrlines = Split(resp, vbCrLf)

'Populate textbox grid
Dim a As Integer
Dim b As Integer = 0

For a = 25 To arrlines.Length Step 12
b += 1
mon(b).Text = Mid(arrlines(a), 9, 2)
If mon(b).Text = Mid(mon(b).Text, 1, 1) & "<" Then
mon(b).Text = Mid(mon(b).Text, 1, 1)
End If
If a + 2 < arrlines.Length Then
state(b).Text = Mid(arrlines(a + 2), 9, 1)
End If
If a + 8 < arrlines.Length Then
fps(b).Text = Mid(arrlines(a + 8), 9, 4)
End If

Next a

'Close connections
'wr.Abort()
wresp.Close()
s.Close()
sr.Close()
resp = ""

As my data is always the same ie same layout but gould be 2 rows could be 15 I used the above to step over irrelevant lines.
Im sure there is a better way but this works, so am looking to learn a cleaner way.

The code then populates a grid of 3x36 textboxes.

Ideally id like to extend this to populate all 26 from different web servers but one is enough for now.
jameswilson at 2007-11-11 21:47:57 >