soundmangav
Programmer
Hi,
I'm developing an interactive Lottery Syndicate program using VB6, which allows members to automatically check their National Lottery numbers against those on the official website, (Access 2000 & SQL application)
Having successfully downloaded the html source code of the results page into a Rich TextBox using the Internet Transfer Control component (Inet), I am now attempting to search through this string, then identify a substring preceeding the numbers themselves, and finally extract these numbers to a listbox or numbers of text boxes (7).
Anyway here's the code I've used, and the problem follows:
Private Sub Command1_Click() 'Get Results Command Button
Dim arr() As String
Dim i As Long
RichTextBox1.Text = Inet1.OpenURL(txtURL.Text, icString) 'Populate RTB with source code
arr = Split(RichTextBox1, vbCrLf) 'Split up each line of the RTB into an Array
For i = 0 To UBound(arr)
If InStr(arr(i), "images/results/numbers"
List1.AddItem Mid$(arr(i), InStr(arr(i), "ALT="
End If
Next
End Sub
Here's a sample of the source code which appears in the RTB: Note there is about a 100 lines preceeding this section, but the lotto numbers themselves are uniquely identified with the preceeding string "images/results/numbers ..."
ie. the info I want to extract lies within the "ALT" Tag, that is for below, "08", "14", "25", "36", "38", "47" and "15".
<IMG SRC="images/results/onresu02.jpg" ALT="Saturday" WIDTH=152 HEIGHT=37 BORDER=0><br>
The winning balls for draw number 654 on 30 March 2002 were:<BR CLEAR=ALL><IMG SRC="images/results/numbers/num08.gif" ALT="08" WIDTH=53 HEIGHT=54 BORDER=0>
<IMG SRC="images/results/numbers/num14.gif" ALT="14" WIDTH=53 HEIGHT=54 BORDER=0>
<IMG SRC="images/results/numbers/num25.gif" ALT="25" WIDTH=53 HEIGHT=54 BORDER=0>
<IMG SRC="images/results/numbers/num36.gif" ALT="36" WIDTH=53 HEIGHT=54 BORDER=0>
<IMG SRC="images/results/numbers/num38.gif" ALT="38" WIDTH=53 HEIGHT=54 BORDER=0>
<IMG SRC="images/results/numbers/num47.gif" ALT="47" WIDTH=53 HEIGHT=54 BORDER=0>
<IMG SRC="images/results/bonus/15.gif" ALT="Bonus Ball 15" WIDTH=83 HEIGHT=68 BORDER=0><BR CLEAR=all>
But for some reason my coding seems to only extract the 2 character value "Sa" from the string:
<IMG SRC="images/results/onresu02.jpg" ALT="Saturday" WIDTH=152 HEIGHT=37 BORDER=0><br>
even though this doesn't corresspond to the identified string:
"images/results/numbers"
why is this so???
Surely it should read through the following source code, locate the string above and extract each instance of the substring (2 characters following "Alt="
If anyone could shed some light on this problem it would be greatly appreciated.
GT.