asked on
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) _
Handles WebBrowser1.DocumentCompleted
'MsgBox(cnt)
Dim t As Timer
t.Start() 'how can I use this to delay the subsequent
'lines of code. Lets say I want a 3 second delay to allow
'a page to fully load (including javascript which the event
'is not waiting for).
Dim MSDNpage As String = WebBrowser1.Document.Body.InnerText
My.Computer.FileSystem.WriteAllText("C:\Quib\" & cnt & ".txt", MSDNpage, False)
nextPage()
End Sub
ASKER
ASKER
ASKER
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) _
Handles WebBrowser1.DocumentCompleted
Dim MSDNpage As String = WebBrowser1.Document.Body.InnerText
My.Computer.FileSystem.WriteAllText("C:\Quib\" & cnt & ".txt", MSDNpage, False)
cnt += 1
If totalPages = 0 Then
totalPages = getTotalPages()
End If
Dim endTime As Date = Now.AddSeconds(3)
While (Now <= endTime)
Application.DoEvents()
End While
If cnt <> totalPages Then
WebBrowser1.Navigate("http://www.quibids.com/categories/Recently-Completed/" & cnt, False)
End If
End Sub
ASKER
ASKER
Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.
TRUSTED BY
Public Sub Delay(ByVal DelayInSeconds As Integer)
Dim ts As TimeSpan
Dim targetTime As DateTime = DateTime.Now.AddSeconds(De
Do
ts = targetTime.Subtract(DateTi
Application.DoEvents()
System.Threading.Thread.Sl
Loop While (ts.TotalSeconds > 0)
End Sub
Added to your code:
Private Sub WebBrowser1_DocumentComple
ByVal e As System.Windows.Forms.WebBr
Handles WebBrowser1.DocumentComple
Delay(3)
Dim MSDNpage As String = WebBrowser1.Document.Body.
My.Computer.FileSystem.Wri
nextPage()
End Sub