1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to use Default Timer to close browser

Discussion in 'Visual Basic .NET' started by SEOboss, Jun 29, 2011.

  1. SEOboss

    SEOboss Junior Member

    Joined:
    Nov 23, 2009
    Messages:
    169
    Likes Received:
    38
    Occupation:
    IM
    Location:
    India
    Hi

    I developed one application which work with multthreading using webbrowser.
    I need help with implementing default timer to close browser as some times sites does not respond or dont have signup page etc so i wish to close browser after default time out, and will move to next site
     
  2. Hydrogen

    Hydrogen Newbie

    Joined:
    Dec 30, 2009
    Messages:
    39
    Likes Received:
    23
    Occupation:
    Co-Owner of AdvertMarketing
    Home Page:
    Since you are spawning your own threads with the Webbrowser control, **Shudders** (Look into httpWebRequest, Unless your app truely needs a Browser control, if not Get as far away from it as possible), then you can sync lock the thread and then when you want to force thread close set keepRunning to False

    Code:
    Dim keepRunning as Boolean
    ...
    While keepRunning 'keeps thread running forever
         SyncLock accessLock
               If endThread Then
                    keepRunning = False
               End If
         End SyncLock
    End While
    
     
    • Thanks Thanks x 1