Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

VS 2008 multiple form and webbrowser question

$
0
0
I have a webbrowser1 on form1.

I want a user to click a button on form4 and have it navigate webbrowser1 from www.google.com to www.yahoo.com and then after the navigation is complete do something else.


The problem is that when I navigate webbrowser1 it does not navigate unless a messagebox pops up. this is my form4 buttonclick code. I tried using the webbrowser navigate completed event and creating a webbrowser while busy loop and neither worked because the webbrowser does not navigate.


'webbrowser1 url is currently www.yahoo.com

If Not Form1.WebBrowser1.Url.ToString Like "*google*" Then
Form1.WebBrowser1.Navigate("http://www.google.com/")
end if


Debug.Print(Form1.WebBrowser1.Url.ToString)
'shows yahoo.com because the webbrowser1 has not navigated
'if I wait for the navigate completed event i'll wait forever because the navigate has not started

MsgBox("done")
'this msgbox appears to be making the webbrowser navigate
'which then does my webbrowser while busy loop and fires the webbrowser1 navigate completed event

Debug.Print(Form1.WebBrowser1.Url.ToString)
'only after the msgbox was displayed is the url now www.google.com




how can i get the webbrowser from another form to navigate without having the user click on a msgbox?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>