Solved

Waiting for a page to load before continuing

Posted on 2006-07-08
7
213 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
  • 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

860 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