Solved

Waiting for a page to load before continuing

Posted on 2006-07-08
7
198 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now