Results 1 to 14 of 14

Thread: using a listbox to control webbrowser functions I NEED HELP

  1. #1

    Thread Starter
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    Thumbs up 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

  2. #2

    Thread Starter
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    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

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: using a listbox to control webbrowser functions I NEED HELP

    try like
    vb Code:
    1. Browser.Navigate ("http://WebSiteName.com" & List1.Text)
    2. do until browser.readystate = 4
    3.   doevents
    4. loop
    5. ' 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

  4. #4

    Thread Starter
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    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?

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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:
    1. for i = 0 to listbox1.listcount - 1
    2.    wb.navigate2 listbox1.list(i)
    3.    do until wb.readystate = 4
    4.       doevents
    5.    loop
    6. 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

  6. #6

    Thread Starter
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    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

  7. #7
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

  8. #8

    Thread Starter
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    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

  9. #9
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

  10. #10

    Thread Starter
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    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

  11. #11
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: using a listbox to control webbrowser functions I NEED HELP

    try like
    vb Code:
    1. For i = 0 To LisT.ListCount - 1
    2. BrowSerA.Navigate2 "http://url.com& LisT.LisT(i)
    3. Do Until BrowSerA.ReadyState = 4
    4.    DoEvents
    5. Loop
    6. BrowSerA.Document.All("button name").Click
    7. do untill browsera.ReadyState = 4
    8.    DoEvents
    9. Loop
    10. 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

  12. #12

    Thread Starter
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    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

  13. #13

    Thread Starter
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    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?

  14. #14
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: using a listbox to control webbrowser functions I NEED HELP

    because you can't spell
    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
  •  



Click Here to Expand Forum to Full Width