aplelois
asked on
1+ on next page
hello,
I have this button but I would like to make something so that it goes to the next page
page1 has this code -> javascript:GotoPage(2);
page2 has this code -> javascript:GotoPage(3);
etc... until 250
this code is working fine but it only goes to page 2, so I would like to make something
that goes to the next page every 5 secs. how can I do this?
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
Dim thisDoc As mshtml.IHTMLDocument2 = WebBrowser1.Document.DomDo cument
For Each objItem As Object In thisDoc.all.tags("a")
If objItem.HRef = "javascript:GotoPage(2);" Then
objItem.Click()
Exit For
End If
Next
End Sub
I have this button but I would like to make something so that it goes to the next page
page1 has this code -> javascript:GotoPage(2);
page2 has this code -> javascript:GotoPage(3);
etc... until 250
this code is working fine but it only goes to page 2, so I would like to make something
that goes to the next page every 5 secs. how can I do this?
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
Dim thisDoc As mshtml.IHTMLDocument2 = WebBrowser1.Document.DomDo
For Each objItem As Object In thisDoc.all.tags("a")
If objItem.HRef = "javascript:GotoPage(2);" Then
objItem.Click()
Exit For
End If
Next
End Sub
ASKER
is going to page 2 then page 1 then page 2 etc...
ASKER
well the page also has this in it too!
<a href="javascript:GotoPage( 1);">1</a>
<a href="javascript:GotoPage( 2);">2</a>
<a href="javascript:GotoPage( 3);">3</a>
<a href="javascript:GotoPage( 4);">4</a>
<a href="javascript:GotoPage( 5);">5</a>
<a href="javascript:GotoPage( 250);">250 </a>
<a href="javascript:GotoPage(
<a href="javascript:GotoPage(
<a href="javascript:GotoPage(
<a href="javascript:GotoPage(
<a href="javascript:GotoPage(
<a href="javascript:GotoPage(
ok didn't see that
you could declare a integer in your form as a sort of module variable
Dim myInt As Integer
then when the timertick comes by you use it to click the correct button and add 1 tot the counter
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim thisDoc As mshtml.IHTMLDocument2 = WebBrowser1.Document.DomDo cument
For Each objItem As Object In thisDoc.all.tags("a")
If objItem.HRef = "javascript:GotoPage(" & myInt & ");" Then
objItem.Click()
myInt = myInt + 1
Exit For
End If
Next
End Sub
you could declare a integer in your form as a sort of module variable
Dim myInt As Integer
then when the timertick comes by you use it to click the correct button and add 1 tot the counter
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim thisDoc As mshtml.IHTMLDocument2 = WebBrowser1.Document.DomDo
For Each objItem As Object In thisDoc.all.tags("a")
If objItem.HRef = "javascript:GotoPage(" & myInt & ");" Then
objItem.Click()
myInt = myInt + 1
Exit For
End If
Next
End Sub
ASKER
is not working
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
amazing! thank you so much!
glad to help, thanks for the grade :)
ASKER
bruintje, how can I make it stop when is at the 150 page?
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim thisDoc As mshtml.IHTMLDocument2 = WebBrowser1.Document.DomDo cument
if myInt = 150 then
Timer1.Enabled = False
Exit sub
end if
For Each objItem As Object In thisDoc.all.tags("a")
If objItem.HRef = "javascript:GotoPage(" & myInt & ");" Then
objItem.Click()
myInt = myInt + 1
Exit For
End If
Next
End Sub
Dim thisDoc As mshtml.IHTMLDocument2 = WebBrowser1.Document.DomDo
if myInt = 150 then
Timer1.Enabled = False
Exit sub
end if
For Each objItem As Object In thisDoc.all.tags("a")
If objItem.HRef = "javascript:GotoPage(" & myInt & ");" Then
objItem.Click()
myInt = myInt + 1
Exit For
End If
Next
End Sub
ASKER
oh man how I love VB.NET is so cool, thanks again! whooo
glad you are happy, looking at all those questions you are really building some application while i only help with parts :-)
good luck with the project
good luck with the project
you can try something like
1. put the timer on the form and set it to 5000 milliseconds
2. you can opt for enabling the timer on a button click as you did in an earlier question
3. in the timer tick you an put the next click
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim thisDoc As mshtml.IHTMLDocument2 = WebBrowser1.Document.DomDo
For Each objItem As Object In thisDoc.all.tags("a")
If InStr(objItem.HRef, "javascript:GotoPage(") > 0 Then ' check here if the gotopage is part of the href of this object
objItem.Click()
Exit For
End If
Next
End Sub
hope this helps a bit
bruintje