Wait for an event result within a sub

Discussion in 'Questions (Windows Mobile)' started by Cableguy, Jan 25, 2009.

  1. Cableguy

    Cableguy Expert Licensed User

    Hi guys...
    is it possible to wait for an event result within a sub???
    Ussing a webbrowser object, call the navigate method, and wait for it to raise the navigated event in order to retrieve some info...
    I know that i can do it with cascating subs....sub is it possible to without leaving the same sub?
  2. agraham

    agraham Expert Licensed User

    If you need to do this then your program structure is probably not optimal. The problem is that the event sub needs to run on the main thread and your call to the navigate method is also on this thread so you need to exit your sub so that the message loop can run to process the event code.

    For the reason given above I don't think you can!

    You can do it with a loop around DoEvents but it is a bit inelegant and burns processor cycles, but on a desktop it probably doesn't matter.
    Flag = false
    Do While Flag = false

    Sub Web_Navigated
      Flag = 
    End Sub
  3. Cableguy

    Cableguy Expert Licensed User

    Thanks andrew...
    I need to re-think all the aproach....
    DllToDate relies on a lot of navigated events, so I'm already using flags, but it will be a bit more easyer now that I know HOW to DOWNLOAD a file from the restricted area...;)
  4. taximania

    taximania Well-Known Member Licensed User

    Last edited: Jan 25, 2009
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice