Results 1 to 9 of 9

Thread: [RESOLVED] Wait for webbrowser finish navigate

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    177

    Resolved [RESOLVED] Wait for webbrowser finish navigate

    Is there any little piece of programming to get a process halt until the webbrowser is finished navigating and the control WebBrowser1 is accessible.

    My application starts with the webbrowser navigate to a specific url. Then I can manually use a Command1 to copy text from my webbrowser, as I wait to see if the browser has finished.
    But I want the program itself to wait for it, indicating the browser is ready and then carry on with he rest of the program, without any Command button pressed...

    Is that possible ?

    /Kalle

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Wait for webbrowser finish navigate

    Try using the WebBrowser1_NavigateComplete2 event.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: Wait for webbrowser finish navigate

    there is a downloadcomplete event on the webrowser control. maybe if u call the button_click event on that it might solve your problem

  4. #4
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Wait for webbrowser finish navigate

    Will this help ?
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    177

    Re: Wait for webbrowser finish navigate

    Well, thanks anyway, iPrank !

    This little piece of code worked too fine.... The sub routine kept on and on and on, never stopped...

    Found an other code, that keep the program waiting for the webbowser to finish:

    Code:
    Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
    
    Do Until WebBrowser1.Busy = False
        DoEvents
        Sleep 800
    Loop
    /Kalle

  6. #6
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Wait for webbrowser finish navigate

    Don't use sleep with interval 800ms. It may slowdown other events - like moving/painting the form - specially when net connection is slow.
    Use ~25ms interval.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    177

    Re: Wait for webbrowser finish navigate

    OK ! Thanks !

    I've tried several different ms, but not as short as 25 ms. Maybe a reason for other difficulties that I recently wrote about.... (see an other issue...)

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Wait for webbrowser finish navigate

    Seems you have it working now.

    Ps, dont forget to Resolve your thread from the Thread Tools menu so others know its been solved.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    177

    Re: Wait for webbrowser finish navigate

    Yes ! I will resolve it as soon as I get the whole thing working...
    Sorry that I've put it in two different threads, but both of them will be cleared (Resolved) when I'm finished...

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