|
-
Nov 4th, 2009, 11:36 AM
#1
Thread Starter
Lively Member
using a listbox to control webbrowser functions I NEED HELP
ok i need to know how to make the webbrowser control goto a certian website then when its at that website stay there untill the user hits a button on the webbrowser control like for example
if i load the list with usernames and want the webbrowser to goto their webpage then wait for me to hit a certian button on the webbrowser then change to the next webpage and so on
i can get it to goto the webpage using a timer but how do i make it stop at the page and wait untill a certian button is pressed?
i know i use this to goto the webpage using the listbox
Code:
Browser.Navigate ("http://WebSiteName.com" & List1.Text)
but i i need it to goto the webpage and not scroll to the nextpage untill im finish
this is what i have so far it is in a timer
Code:
Browser.Navigate ("http://WebSiteName.com" & List1.Text)
If Browser.LocationURL = ("http://WebSiteName.com" & List1.Text) Then
List1.ListIndex = List1.ListIndex + 1
End If
-
Nov 4th, 2009, 12:42 PM
#2
Thread Starter
Lively Member
Re: using a listbox to control webbrowser functions I NEED HELP
do i not use a timer? or do i use the webbrowser it self? i am confused at this point should i put a pause function in it or what
-
Nov 4th, 2009, 03:31 PM
#3
Re: using a listbox to control webbrowser functions I NEED HELP
try like
vb Code:
Browser.Navigate ("http://WebSiteName.com" & List1.Text) do until browser.readystate = 4 doevents loop ' page loaded do more stuff
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Nov 5th, 2009, 01:43 AM
#4
Thread Starter
Lively Member
Re: using a listbox to control webbrowser functions I NEED HELP
how would i use that with a listbox?
i get it will goto the item in the listbox but after its done how do i get it to goto the next item?
-
Nov 5th, 2009, 04:48 AM
#5
Re: using a listbox to control webbrowser functions I NEED HELP
where it says do more stuff, navigate to the next listbox item as you did in your previous posting
or in a loop like
vb Code:
for i = 0 to listbox1.listcount - 1 wb.navigate2 listbox1.list(i) do until wb.readystate = 4 doevents loop next
Last edited by westconn1; Nov 5th, 2009 at 04:52 AM.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Nov 5th, 2009, 08:34 PM
#6
Thread Starter
Lively Member
Re: using a listbox to control webbrowser functions I NEED HELP
how would i make it click a button after it goes to the page? i got the code to click the button but it errors out
-
Nov 5th, 2009, 09:17 PM
#7
Re: using a listbox to control webbrowser functions I NEED HELP
which page?
as soon as the page loads it goes to the next, so you would get error
as i don't know the source i can only guess at clicking the button
wb.document.forms(0).submit
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Nov 5th, 2009, 09:54 PM
#8
Thread Starter
Lively Member
Re: using a listbox to control webbrowser functions I NEED HELP
how would i make it wait till i the button is clicked to go on to the next page? thats what i ment .... i know how to click the button but after i click it i need it to wait untill the next page loads then goto the next url in the listbox
-
Nov 6th, 2009, 03:01 AM
#9
Re: using a listbox to control webbrowser functions I NEED HELP
click the button code goes between loop and next
you probably need to loop again, after clicking the button, until the readystate = readystatecomplete (4), otherwise it will immediately start loading the next url in the listbox
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Nov 6th, 2009, 03:49 AM
#10
Thread Starter
Lively Member
Re: using a listbox to control webbrowser functions I NEED HELP
what am i doing wrong?
Code:
For i = 0 To LisT.ListCount - 1
BrowSerA.Navigate2 "http://url.com& LisT.LisT(i)
Do Until BrowSerA.ReadyState = 4
DoEvents
Loop
For X = 0 To LisT.ListCount
do untill browsera.ReadyState = 1
DoEvents
BrowSerA.Document.All("button name").Click
Loop
Next
on the second do untill i get a syntax error
-
Nov 6th, 2009, 04:37 AM
#11
Re: using a listbox to control webbrowser functions I NEED HELP
try like
vb Code:
For i = 0 To LisT.ListCount - 1 BrowSerA.Navigate2 "http://url.com& LisT.LisT(i) Do Until BrowSerA.ReadyState = 4 DoEvents Loop BrowSerA.Document.All("button name").Click do untill browsera.ReadyState = 4 DoEvents Loop Next
use option explicit at the top of your code window
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Nov 6th, 2009, 11:47 AM
#12
Thread Starter
Lively Member
Re: using a listbox to control webbrowser functions I NEED HELP
i still get a syntax error
what am i doing wrong?
Code:
Dim i As Integer
For i = 0 To LisT.ListCount - 1
BrowSerA.Navigate2 "http://url.com& LisT.LisT(i)"
Do Until BrowSerA.ReadyState = 4
DoEvents
Loop
BrowSerA.Document.All("button name").Click
do untill browsera.ReadyState = 4
DoEvents
Loop
Next
-
Nov 6th, 2009, 11:48 AM
#13
Thread Starter
Lively Member
Re: using a listbox to control webbrowser functions I NEED HELP
i get a syntax error on the second
Code:
do untill browsera.readystate = 4
why is that?
-
Nov 6th, 2009, 02:47 PM
#14
Re: using a listbox to control webbrowser functions I NEED HELP
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|