Results 1 to 4 of 4

Thread: Navigate2 - set timeout

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2006
    Posts
    7

    Navigate2 - set timeout

    How do you set a timeout when using AxWebBrowser1.Navigate2 ?

    I have a list of URLs, some of which need to be skipped whenever they load too slowly using AxWebBrowser_documentcomplete

    In case its not obvious, I'm new to client side programming and just started with VB.NET

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Navigate2 - set timeout

    You would need to use a timer to keep track of the elapsed time since the navigate method was called and when you want it to timeout.

    is there any reason you are using navigate2 instead of just navigate?

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2006
    Posts
    7

    Re: Navigate2 - set timeout

    Thank you for the Timer suggestion. I will have to research how that is done. Please post short example code if possible.

    On the question of why I'm using Navigate2 instead of just Navigate, I wasn't sure what the functional difference was between the two. Navigate2 was used in the book that I had, so I went with their suggestion.

    Much to learn...

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Navigate2 - set timeout

    Navigate2 was added to allow for shellintegration, Navigate is still a usable routine, and unless you have a NEED to use Navigate2, you should use Navigate

    a timer is pretty simple, you will find it in your toolbox in the components tab.

    It has a .Start method that will start the counting and a .Stop method that will stop the couting. it has an interval property that you can set so it will fire each time that interval is hit. Its in milliseconds, so 1000 = 1 second

    Timer has an elapsed event which fires each time the interval is hit.

    So lets say you wanted it to try to connect to the page for 10 seconds, 10 x 1000 = 10000 so that is your interval that you would set.

    When you call the navigate method, you would start the timer, and then in the timers elapsed event, you would call the .stop method, since there is no reason to keep the timer going since it has fired after the 10 seconds. you would also put code in the timer event to do what you want to do (ie, navigate to another page, since the first one didnt load in 10 seconds)

    you would also put some code in the documentcomplete event to stop the timer because it DID navigate to the page in under 10 seconds.

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