A
Adam Sandler
Hello,
I'd like to do a slide show in VB. I have one in JavaScript but the
one in JavaScript always counts on the images to be in a given
directory. This doesn't have to be fancy... something like...
Me.Image1.ImageUrl = myArray(i) and automatically repeating. The
reasons for why I want to do it in VB follow.
The images for this slideshow will be retrieved from links on a
webpage. The code for this uses regular expressions to search for the
files... the files conform to a standard naming scheme so any risk is
minimized
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
CONST WEBPAGE =
"http://www.srh.noaa.gov/ridge/RadarImg/N0R/FTG/"
Dim objHTTP
Dim strHTMLSource As String
' Get stuff from other webpage
objHTTP = CreateObject("Microsoft.XMLHTTP")
objHTTP.Open("Get", WEBPAGE, False)
objHTTP.Send()
' Load the target webpage into memory... it's small
strHTMLSource = objHTTP.ResponseText
' Look for files which begin with "FTG"
myMatcher("FTG", strHTMLSource)
End Sub
' myMatcher(what I'm looking for, where to search)
Sub myMatcher(ByVal strMatchPattern, ByVal strSource)
Dim i, j As Integer
Dim myRegEx As Regex = New Regex(strMatchPattern,
RegexOptions.IgnoreCase)
Dim c As MatchCollection = myRegEx.Matches(strSource)
i = 0
' iterate through the collection
Dim m As Match
For Each m In c
ReDim Preserve myArray(i)
myArray(i) = m.Index
i = i + 1
Next
Dim s As String
' Get the most recent 10 file names...
' Accomplished by using the positions found by the pattern
matcher
For j = UBound(myArray) To (UBound(myArray) - 20) Step -1
' remainder division eliminates duplicate file names which
would be sucked up
' from both the link's text and the a href tag
If j Mod 2 = 0 Then
s = Mid(strSource, myArray(j + 1), 26)
Response.Write(s & "<br />") ' for debug...
End If
Next
Once I get the files I'm interested in using, then I figured I could
just loop through the array and provide an asp image object the url
contained in anyArray(i).
u = UBound(myArray)
For i = 0 To (u - 1)
Me.Image1.ImageUrl = myArray(i)
System.Threading.Thread.Sleep(3000)
Next
Doing something like the preceeding loop doesn't work... I really don't
want anymore complexity then something like the loop above and the
images to automatically repeat. Any suggestions?
Thanks!
I'd like to do a slide show in VB. I have one in JavaScript but the
one in JavaScript always counts on the images to be in a given
directory. This doesn't have to be fancy... something like...
Me.Image1.ImageUrl = myArray(i) and automatically repeating. The
reasons for why I want to do it in VB follow.
The images for this slideshow will be retrieved from links on a
webpage. The code for this uses regular expressions to search for the
files... the files conform to a standard naming scheme so any risk is
minimized
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
CONST WEBPAGE =
"http://www.srh.noaa.gov/ridge/RadarImg/N0R/FTG/"
Dim objHTTP
Dim strHTMLSource As String
' Get stuff from other webpage
objHTTP = CreateObject("Microsoft.XMLHTTP")
objHTTP.Open("Get", WEBPAGE, False)
objHTTP.Send()
' Load the target webpage into memory... it's small
strHTMLSource = objHTTP.ResponseText
' Look for files which begin with "FTG"
myMatcher("FTG", strHTMLSource)
End Sub
' myMatcher(what I'm looking for, where to search)
Sub myMatcher(ByVal strMatchPattern, ByVal strSource)
Dim i, j As Integer
Dim myRegEx As Regex = New Regex(strMatchPattern,
RegexOptions.IgnoreCase)
Dim c As MatchCollection = myRegEx.Matches(strSource)
i = 0
' iterate through the collection
Dim m As Match
For Each m In c
ReDim Preserve myArray(i)
myArray(i) = m.Index
i = i + 1
Next
Dim s As String
' Get the most recent 10 file names...
' Accomplished by using the positions found by the pattern
matcher
For j = UBound(myArray) To (UBound(myArray) - 20) Step -1
' remainder division eliminates duplicate file names which
would be sucked up
' from both the link's text and the a href tag
If j Mod 2 = 0 Then
s = Mid(strSource, myArray(j + 1), 26)
Response.Write(s & "<br />") ' for debug...
End If
Next
Once I get the files I'm interested in using, then I figured I could
just loop through the array and provide an asp image object the url
contained in anyArray(i).
u = UBound(myArray)
For i = 0 To (u - 1)
Me.Image1.ImageUrl = myArray(i)
System.Threading.Thread.Sleep(3000)
Next
Doing something like the preceeding loop doesn't work... I really don't
want anymore complexity then something like the loop above and the
images to automatically repeat. Any suggestions?
Thanks!