ferreira12 0 Posted August 1, 2013 Report Share Posted August 1, 2013 Boas. Eu tenho o primeiro link que carrega uma informação através de uns parâmetros que eu lhe mando, e só depois de ela carregar a informação é que o outro link funciona, pois está dependente do anterior. Eu em teste estou a usei 2 botoes, em que o primeiro carrega o primeiro link, e só depois de carregado e que clico no outro botão de modo a carregar a informaçao do segundo link. Mas eu gostaria de colocar isto mais pratico/automático. Não existe nenhum método que verifique que o WebBrowser1 está carregado, então carrega o WebBrowser2? Link to post Share on other sites
cdaniel.marques 1 Posted August 1, 2013 Report Share Posted August 1, 2013 DocumentCompleted? Exemplo: Private Sub PrintHelpPage() ' Create a WebBrowser instance. Dim webBrowserForPrinting As New WebBrowser() ' Add an event handler that prints the document after it loads. AddHandler webBrowserForPrinting.DocumentCompleted, New _ WebBrowserDocumentCompletedEventHandler(AddressOf PrintDocument) ' Set the Url property to load the document. webBrowserForPrinting.Url = New Uri("\\myshare\help.html") End Sub Private Sub PrintDocument(ByVal sender As Object, _ ByVal e As WebBrowserDocumentCompletedEventArgs) Dim webBrowserForPrinting As WebBrowser = CType(sender, WebBrowser) ' Print the document now that it is fully loaded. webBrowserForPrinting.Print() MessageBox.Show("print") ' Dispose the WebBrowser now that the task is complete. webBrowserForPrinting.Dispose() End Sub Fonte: http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.documentcompleted.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1 Link to post Share on other sites
andrempv 0 Posted August 15, 2013 Report Share Posted August 15, 2013 (edited) uhm vendo isso bem só tenho duas ideas Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted If WebBrowser1.Url.ToString = "Seu link" Then ' Se o seu link for este abre o webrowser2 Webrowser2.show() End If End sub Outra maneira Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted Webrowser2.show() 'quando o site estiver carregado abrir o webrowser 2 End If End Sub Mais simples? impossivel. Edited August 15, 2013 by andrempv Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now