Solved

Waiting for a page to load before continuing

Posted on 2006-07-08
7
225 Views
Last Modified: 2010-04-23
I've got an internet explorer opened in one of my forms.  What is the correct way to code, so that it waits until the entire page is completely loaded before continuing on??

0
Comment
Question by:Marc333
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 14

Accepted Solution

by:
jjardine earned 500 total points
ID: 17065998
Hey Marc333    please take a look at this post I did a while back regarding ie and waiting for page complete.  
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21777756.html     

The article address a person wanting to print the page but has to wait for it to load first.  You should be able to do the same thing here.   This uses the Internet Explorer Object.  I am not sure if that is the same as the new webbrowser object in 2005.   What version are you running?
0
 
LVL 3

Author Comment

by:Marc333
ID: 17066059
jjardine,
I'm using an older version, 2002.  I see where it is mentioned to use an addhandler.  I'm still new to .Net, but I'm guessing it looks something like:
AddHandler Explorer.DownloadBegin, AddressOf nameofevent

Is this how you handled it?  What did you use for the Addressof?
0
 
LVL 3

Author Comment

by:Marc333
ID: 17066069
sorry, I meant documentcomplete instead of downloadbegin
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Expert Comment

by:jjardine
ID: 17066269
yes it would be just like you said.   Create a method to call and use AddHandler just like you stated..  That should work.
0
 
LVL 3

Author Comment

by:Marc333
ID: 17066595
jjardine,
I've got one problems though.  It looks like I've got it working fairly well, except once it loads the document, it looks like the handler is firing twice.  Could you take a look and tell me if I'm missing something?

Private Sub Searchbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Searchbtn.Click
        Explorer.Navigate("http://realcomponline.com/asp/search.asp?")
        AddHandler Explorer.DocumentComplete, AddressOf searchload
       
    End Sub

    Public Sub searchload(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent)
        If conn.State <> ConnectionState.Open Then conn.Open()

        Dim dr As DataRow
        Dim str As String = "Select * From MISC where ((ID) = 1);"
        Dim Miscda As New OleDbDataAdapter(str, conn)
        Dim miscds As New DataSet()
        Miscda.Fill(miscds, "Misc")


        Dim vlu As Integer

        SK("+{TAB}", 1)
        SK("{TAB}", 1)
        SendKeys.Send(" ")
        SendKeys.Send("{TAB}")
        SendKeys.Send("05071")

        SendKeys.Send("25")
        SendKeys.Send("{TAB}")
        SendKeys.Send("150")
        SendKeys.Send("{TAB}")

        'SendKeys.Send("~")

    End Sub
0
 
LVL 3

Author Comment

by:Marc333
ID: 17066611
jjardine,
I opened your example in notepad and saw how you were doing the event handler.  Only problem is that I can't use this type of method because I have several events on this form that navigate through several different pages.  And I think this would affect every one of the other events as well (correct me if I missed something)..  Though the addhandler is avoiding this issue.  
0
 
LVL 3

Author Comment

by:Marc333
ID: 17066630
jjardine,
I solved the issue and was able to use your solution by using a variable that I can set for each event.  Thanks for your help.  
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question